[r8244]: docs / trunk / publican / rexxref / en-US / fundclasses.xml Maximize Restore History

Download this file

fundclasses.xml    6625 lines (6146 with data), 266.4 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "rexxref.ent">
%BOOK_ENTITIES;
]>
<!--#########################################################################
#
# Description: Open Object Rexx: Reference XML File
#
# Copyright (c) 2005-2012, Rexx Language Association. All rights reserved.
# Portions Copyright (c) 2004, IBM Corporation. All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Common Public License v1.0 which accompanies this
# distribution. A copy is also available at the following address:
# http://www.oorexx.org/license.html
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the distribution.
#
# Neither the name of Rexx Language Association nor the names
# of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#########################################################################
-->
<section id="fundclasses"><title>The Fundamental Classes</title>
<para>This section describes the Rexx fundamental classes.</para>
<section id="clsObject"><title>The Object Class</title>
<indexterm><primary>Object class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Object class</secondary></indexterm>
<para>The Object class is the root of the class hierarchy. The instance methods
of the Object class are, therefore, available on all objects.</para>
<figure><title>The Object class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxObjectClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The Object class also has available class methods that its
metaclass, the Class class (<xref linkend="clsClass" />), defines.</para></note>
<section id="mthObjectNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new---------------------------------------------------------><
]]>
</programlisting>
<para>Returns a new instance of the receiver class.</para>
</section>
<section id="mthObjectOperators"><title>Operator Methods</title>
<programlisting>
<![CDATA[
>>-comparison_operator(argument)-------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> (true) or
<computeroutput>0</computeroutput> (false), the result of performing
a specified comparison operation.
</para>
<para>For the Object class, if <emphasis role="italic">argument</emphasis>
is the same object as the receiver
object, the result is <computeroutput>1</computeroutput> (true), otherwise
<computeroutput>0</computeroutput> (false) is returned. Subclasses may override
this method to define equality using different criteria. For example, the String
class determines equality based on the value of the string data.
</para>
<note><title>Note</title>
<para>The MapCollection classes such as Table and Relation use the == operator
combined with the hashCode method (<xref linkend="mthObjectHashCode" />) to determine index and
item equivalence.
It is generally necessary
for a class to override both the hashCode method and the == operator method to maintain
the contract specified for the hashCode method.
See <xref linkend="mthObjectHashCode" /> for details on the contract.
</para></note>
<para>The comparison operators you can use in a message are: </para>
<variablelist>
<varlistentry><term>=, ==
<indexterm><primary>= method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>== method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>=</secondary>
<tertiary>of Object class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>==</secondary>
<tertiary>of Object class</tertiary></indexterm>
</term>
<listitem><para>True if the terms are the same object.
</para></listitem></varlistentry>
<varlistentry><term>\=, >&lt;, &lt;>, \==
<indexterm><primary>\= method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>>&lt; method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>&lt;> method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>\== method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>\=</secondary>
<tertiary>of Object class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>>&lt;</secondary>
<tertiary>of Object class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;></secondary>
<tertiary>of Object class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>\==</secondary>
<tertiary>of Object class</tertiary></indexterm>
</term>
<listitem><para>True if the terms are not the same object (inverse of =).
</para></listitem></varlistentry>
</variablelist>
</section>
<section id="mthObjectConcatenationMethods"><title>Concatenation Methods</title>
<indexterm><primary>method</primary>
<secondary>concatenation methods</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-concatenation_operator(argument)----------------------------><
]]>
</programlisting>
<para>Returns a new string that is the concatenation the of receiver object's string value with
<emphasis role="italic">argument</emphasis>. (See
<xref linkend="strgcon" />.)
The <emphasis role="italic">concatenation_operator</emphasis> can be: </para>
<variablelist>
<varlistentry><term>&quot;&quot;</term>
<listitem><para>concatenates without an intervening blank. The abuttal operator
&quot;&quot;
is the null string. The language processor uses the abuttal operator to concatenate
two terms that another operator does not separate.
</para></listitem></varlistentry>
<varlistentry><term>||
<indexterm><primary>|| method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>||</secondary></indexterm>
</term>
<listitem><para>concatenates without an intervening blank.
</para></listitem></varlistentry>
<varlistentry><term>&quot;&nbsp;&quot;
</term>
<listitem><para>concatenates with one blank between the receiver
object and the <emphasis role="italic">argument</emphasis>.
(The operator &quot;&nbsp;&quot; is a blank.)
</para></listitem></varlistentry>
</variablelist>
</section>
<section id="mthObjectClass"><title>class</title>
<indexterm><primary>class method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>class method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-class-------------------------------------------------------><
]]>
</programlisting>
<para>Returns the class object that created the object instance.
</para>
</section>
<section id="mthObjectCopy"><title>copy</title>
<indexterm><primary>copy method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>copy method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-copy--------------------------------------------------------><
]]>
</programlisting>
<para>Returns a copy of the receiver object. The copied object has
the same methods as the receiver object and an equivalent set of object
variables, with the same values.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary><emphasis role="bold">copy</emphasis> method</secondary></indexterm>
<programlisting>
myarray=.array~of("N","S","E","W")
/* Copies array myarray to array directions */
directions=myarray~copy
</programlisting>
<note><title>Note</title>
<para>The copy method is a "shallow copy". Only the target object is copied. Additional
objects referenced by the target object are not copied. For example, copying an Array object instance
only copies the array, it does not copy any of the objects stored in the array.
</para></note>
</section>
<section id="mthObjectDefaultName"><title>defaultName</title>
<indexterm><primary>defaultName method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>defaultName method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-defaultName-------------------------------------------------><
]]>
</programlisting>
<para>Returns a short human-readable string representation of the object. The
exact form of this representation depends on the object and might not alone
be sufficient to reconstruct the object. All objects must be able to produce
a short string representation of themselves in this way, even if the object
does not have a string value. See
<xref linkend="reqstr" /> for more information.
The <emphasis role="bold">defaultName</emphasis>
method of the Object class returns a string that identifies
the class of the object, for example, an Array or a Directory. See also
<xref linkend="mthObjectObjectName" /> and
<xref linkend="mthObjectString" />. See
<xref linkend="mthObjectObjectNameEquals" /> for an
example using <emphasis role="bold">defaultName</emphasis>.</para>
</section>
<section id="mthObjectHashCode"><title>hashCode</title>
<indexterm><primary>hashCode method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>hashCode method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-hashCode---------------------------------------------------><
]]>
</programlisting>
<para>Returns a string value that is used as a hash value for MapCollections
such as Table, Relation, Set, Bag, and Directory. MapCollections use this
string value to hash an object for hash table-based searches.</para>
<para>Object implementations are expected to abide by a general contract for hash code usage:</para>
<itemizedlist>
<listitem>
<para>
Whenever hashCode is invoked on the same object more than once, hashCode must return the
same hashcode value, provided than none of the internal information the object uses for an "==" comparison has changed.
</para>
</listitem>
<listitem>
<para>
If two object instances compare equal using the "==" operator, the hashCode methods for both object instances must return
the same value.
</para>
</listitem>
<listitem>
<para>
It is not required that two object instances that compare unequal using "==" return different hash code
values.
</para>
</listitem>
<listitem>
<para>
Returning a wide range of hash values will produce better performance when an object is used as an index for a
MapCollection. A return value of 4 string characters is recommended. The characters in the hash value may be any
characters from '00'x to 'ff'x, inclusive.
</para>
</listitem>
</itemizedlist>
</section>
<section id="mthObjectHasMethod"><title>hasMethod</title>
<indexterm><primary>hasMethod method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>hasMethod method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-hasMethod(methodname)---------------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> (true) if the receiver object
has a method named <emphasis role="italic">methodname</emphasis>
(translated to uppercase).
Otherwise, it returns <computeroutput>0</computeroutput> (false). </para>
<note><title>Note</title>
<para>The hasMethod object will return true even if the target method is defined
as private. A private method has restricted access rules, so its possible to
receive an unknown method error (error 97) when invoking <emphasis role="italic">methodname</emphasis>
even if hasMethod indicates the method exists.
See <xref linkend="pubpri" />
for private method restrictions.
</para></note>
</section>
<section id="mthObjectIdentityHash"><title>identityHash</title>
<indexterm><primary>identityHash method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>identityHash method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-identityHash------------------------------------------------><
]]>
</programlisting>
<para>Returns a unique identity number for the object. This number is guaranteed
to be unique for the receiver object until the object is garbage collected.</para>
</section>
<section id="mthObjectInit"><title>init</title>
<indexterm><primary>init method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>init method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-init--------------------------------------------------------><
]]>
</programlisting>
<para>Performs any required object initialization. Subclasses of the Object
class can override this method to provide more specific initialization.</para>
</section>
<section id="mthObjectInstanceMethod"><title>instanceMethod</title>
<indexterm><primary>instanceMethod method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>instanceMethod method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-instanceMethod(methodname)----------------------------------><
]]>
</programlisting>
<para>Returns the corresponding Method class instance if the
<emphasis role="italic">methodname</emphasis> is a valid method of the class.
Otherwise it returns the Nil object.</para>
</section>
<section id="mthObjectInstanceMethods"><title>instanceMethods</title>
<indexterm><primary>instanceMethods method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>instanceMethods method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-instanceMethods(class)----------------------------------><
]]>
</programlisting>
<para>Returns a Supplier instance containing the names and corresponding method objects
defined by
<emphasis role="italic">class</emphasis>. If the receiver object is not an
instance of <emphasis role="italic">class</emphasis>, the Nil object is returned.
</para>
</section>
<section id="mthObjectIsA"><title>isA</title>
<indexterm><primary>isA method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isA method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-isA(class)--------------------------------------------------><
]]>
</programlisting>
<note><para>This method is an alias of the
isInstance (<xref linkend="mthObjectIsInstanceOf" />) method.</para>
</note>
</section>
<section id="mthObjectIsInstanceOf"><title>isInstanceOf</title>
<indexterm><primary>isInstanceOf method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isInstanceOf method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-isInstanceOf(class)-----------------------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the object is an instance of the specified
<emphasis role="italic">class</emphasis>, otherwise it
returns .false ("0"),
An object is an instance of a class if the object is directly an instance of the
specified <emphasis role="italic">class</emphasis> or if
<emphasis role="italic">class</emphasis> is in the object's direct or mixin
class inheritance chain. For example:
<programlisting>
<![CDATA[
"abc"~isInstanceOf(.string) -> 1
"abc"~isInstanceOf(.object) -> 1
"abc"~isInstanceOf(.mutablebuffer) -> 0
]]>
</programlisting>
</para>
</section>
<section id="mthObjectObjectName"><title>objectName</title>
<indexterm><primary>objectName method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>objectName method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-objectName--------------------------------------------------><
]]>
</programlisting>
<para>Returns any name set on the receiver object using the
<emphasis role="bold">objectName=</emphasis> method. If
the receiver object does not have a name, this method returns the result of
the <emphasis role="bold">defaultName</emphasis> method. See
<xref linkend="reqstr" /> for more information. See
the <emphasis role="bold">objectName=</emphasis>
method for an example using <emphasis role="bold">objectName</emphasis>.</para>
</section>
<section id="mthObjectObjectNameEquals"><title>objectName=</title>
<indexterm><primary>objectName= method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>objectName= method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-objectName=(newname)----------------------------------------><
]]>
</programlisting>
<para>Sets the receiver object's name to the string
<emphasis role="italic">newname</emphasis>.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary><emphasis role="bold">objectName=</emphasis> method</secondary></indexterm>
<programlisting>
points=.array~of("N","S","E","W")
say points~objectName /* (no change yet) Says: "an Array" */
points~objectName=("compass") /* Changes obj name POINTS to "compass"*/
say points~objectName /* Shows new obj name. Says: "compass" */
say points~defaultName /* Default is still available. */
/* Says "an Array" */
say points /* Says string representation of */
/* points "compass" */
say points[3] /* Says: "E"Points is still an array */
/* of 4 items */
</programlisting>
</section>
<section id="mthObjectRequest"><title>request</title>
<indexterm><primary>request method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>request method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-request(classid)--------------------------------------------><
]]>
</programlisting>
<para>Returns an object of the <emphasis role="italic">classid</emphasis>
class, or the Nil object if the request cannot be satisfied.</para>
<para>This method first compares the identity of the object's class (see
the <emphasis role="italic">id</emphasis>
method of the Class class in <xref linkend="mthClassId" />) to
<emphasis role="italic">classid</emphasis>. If they are the same, the
receiver object is returned as the result.
Otherwise, <emphasis role="bold">request</emphasis>
tries to obtain and return an object satisfying
<emphasis role="italic">classid</emphasis> by sending the receiver object the
conversion message <computeroutput>make</computeroutput> with
the string <emphasis role="italic">classid</emphasis> appended (converted to
uppercase). For example,
a <computeroutput>request("string")</computeroutput> message causes a
<emphasis role="bold">makeString</emphasis> message to be sent.
If the object does not have the required conversion method,
<emphasis role="bold">request</emphasis> returns
the Nil object.</para>
<para>The conversion methods cause objects to produce different representations
of themselves. The presence or absence of a conversion method defines an object's
capability to produce the corresponding representations. For example, lists
can represent themselves as arrays, because they have a
<emphasis role="bold">makeArray</emphasis> method,
but they cannot represent themselves as directories, because they do not have
a <emphasis role="bold">makeDirectory</emphasis>
method. Any conversion method must return an object of the
requested class. For example, <emphasis role="bold">makeArray</emphasis>
must return an array. The language
processor uses the <emphasis role="bold">makeString</emphasis>
method to obtain string values in certain contexts;
see <xref linkend="reqstr" />.</para>
</section>
<section id="mthObjectRun"><title>run</title>
<indexterm><primary>run method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>run method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-run(method-+-------------------------------+-)--------------><
| +---------------+ |
| V | |
+-,Individual---+-----------+-+-+
| +-,argument-+ |
+-,Array,argument---------------+
]]>
</programlisting>
<para>Runs the method object <emphasis role="italic">method</emphasis> (see
<xref linkend="clsMethod" />). The
<emphasis role="italic">method</emphasis> has access to the object variables
of the receiver object, as
if the receiver object had defined the method by using
<emphasis role="bold">setMethod</emphasis>.</para>
<para>If you specify the Individual or Array option, any remaining
<emphasis role="italic">argument</emphasis>s are arguments for the method.
(You need to specify only the first letter;
all characters following the first character are ignored.) </para>
<variablelist>
<varlistentry><term>Individual</term>
<listitem><para>Passes any remaining arguments to the method as arguments in
the order you specify them.
</para></listitem></varlistentry>
<varlistentry><term>Array</term>
<listitem><para>Requires <emphasis role="italic">argument</emphasis>,
which is an array object. (See <xref linkend="clsArray" />.)
The member items of the array are passed to the method
as arguments. The first argument is at index 1, the second argument at index
2, and so on. If you omitted any indexes when creating the array, the
corresponding arguments are omitted when passing the arguments.
</para></listitem></varlistentry>
</variablelist>
<para>If you specify neither Individual nor Array, the method runs without
arguments.</para>
<para>The <emphasis role="italic">method</emphasis> argument can be a string
containing a method source line instead of a method object.
Alternatively, you can pass an array of strings
containing individual method lines. In either case,
<emphasis role="bold">run</emphasis> creates an equivalent
method object.</para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>The <emphasis role="bold">run</emphasis> method is a
private method.
See <xref linkend="pubpri" />
for information private method restrictions.
</para></listitem>
<listitem><para>The RUN method is a protected method.</para></listitem>
</orderedlist>
</section>
<section id="mthObjectSend"><title>send</title>
<indexterm><primary>send method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>send method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
+---------------+
V |
>>-send(messagename---+-----------+-+-)-----------------------><
+-,argument-+
]]>
</programlisting>
<para>Returns a result of invoking a method on the target object
using the specified message name and arguments.
The send() method allows methods to be invoked using dynamically
constructed method names.
</para>
<para>The <emphasis role="italic">messagename</emphasis> can be a string or
an array. If <emphasis role="italic">messagename</emphasis> is an array object,
its first item is the name of the message and its
second item is a class object to use as the starting point for the method
search. For more information, see
<xref linkend="meths1" />.</para>
<para>Any
<emphasis role="italic">argument</emphasis>s are passed to the receiver as
arguments for <emphasis role="italic">messagename</emphasis> in the order you
specify them.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
world=.WorldObject~new
-- the following 3 calls are equivalent
msg1=world~hello("Fred")
msg2=world~send("HELLO", "Fred")
msg3=.message~new(world,"HELLO", "i", "Fred")~~send
say msg1 /* Produces Hello Fred 21:04:25.065000 */
/* for example */
say msg2 /* Produces Hello Fred 21:04:25.081000 */
/* for example */
say msg3~result /* Produces Hello Fred 21:04:25.101000 */
/* for example */
::class 'WorldObject' public
::method hello
use arg name
return "Hello" name time('L')
</programlisting>
</section>
<section id="mthObjectSendWith"><title>sendWith</title>
<indexterm><primary>sendWith method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>sendWith method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-sendWith(messagename,arguments)--------------------------------><
]]>
</programlisting>
<para>Returns a result of invoking a method on the target object
using the specified message name and arguments.
The send() method allows methods to be invoked using dynamically
constructed method names and arguments.
</para>
<para>The <emphasis role="italic">messagename</emphasis> can be a string or
an array. If <emphasis role="italic">messagename</emphasis> is an array object,
its first item is the name of the message and its
second item is a class object to use as the starting point for the method
search. For more information, see
<xref linkend="meths1" />.</para>
<para>The <emphasis role="italic">arguments</emphasis> argument must be
a single-dimension array instance.
The values contained in
<emphasis role="italic">arguments</emphasis> are passed to the receiver as
arguments for <emphasis role="italic">messagename</emphasis> in the order you
specify them.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
world=.WorldObject~new
// the following 3 calls are equivalent
msg1=world~hello("Fred")
msg2=world~sendWith("HELLO", .array~of("Fred"))
msg3=.message~new(world,"HELLO", "A", .array~of("Fred"))~~send
say msg1~result /* Produces Hello Fred 21:04:25.065000 */
/* for example */
say msg2~result /* Produces Hello Fred 21:04:25.081000 */
/* for example */
say msg3~result /* Produces Hello Fred 21:04:25.101000 */
/* for example */
::class 'WorldObject' public
::method hello
use arg name
return "Hello" name time('L')
</programlisting>
</section>
<section id="mthObjectSetMethod"><title>setMethod</title>
<indexterm><primary>setMethod method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setMethod method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setMethod(methodname-+----------------------+--)-----------------><
| +-,"FLOAT"-+ |
+-,method-+----------+-+
+--,scope--+
]]>
</programlisting>
<para>Adds a method to the receiver object's
collection of object methods. The <emphasis role="italic">methodname</emphasis>
is the name of the new
method. This name is translated to uppercase. If you
previously defined a method with the same name using
<emphasis role="bold">setMethod</emphasis>, the new method
replaces the earlier one. If you omit <emphasis role="italic">method</emphasis>,
<emphasis role="bold">setMethod</emphasis> makes the
method name <emphasis role="italic">methodname</emphasis> unavailable for the
receiver object. In this
case, sending a message of that name to the receiver object runs the
<emphasis role="bold">unknown</emphasis>
method (if any).</para>
<para>The <emphasis role="italic">method</emphasis> can be a string containing
a method source line instead
of a method object. Or it can be an array of strings containing individual
method lines. In either case, <emphasis role="bold">setMethod</emphasis>
creates an equivalent method object.
</para>
<para>The third parameter describes if the method that is attached to an
object should have object or float scope. "Float" scope means that
it shares the same scope with methods that were defined outside of
a class. "Object" scope means it shares the scope with other,
potentially statically defined, methods of the object it is
attached to.</para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>The <emphasis role="bold">setMethod</emphasis>
method is a private method.
See the <emphasis role="bold">setPrivate</emphasis> method
in <xref linkend="mthMethodSetPrivate" /> for details.
</para>
</listitem>
<listitem><para>The <emphasis role="bold">setMethod</emphasis>
method is a protected method.</para></listitem>
</orderedlist>
</section>
<section id="mthObjectStart"><title>start</title>
<indexterm><primary>start method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>start method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
+---------------+
V |
>>-start(messagename---+-----------+-+-)-----------------------><
+-,argument-+
]]>
</programlisting>
<para>Returns a message object (see
<xref linkend="clsMessage" />) and sends it a
<emphasis role="bold">start</emphasis> message
to start concurrent processing. The object receiving the message
<emphasis role="italic">messagename</emphasis> processes this message
concurrently with the sender's continued processing.</para>
<para>The <emphasis role="italic">messagename</emphasis> can be a string or
an array. If <emphasis role="italic">messagename</emphasis> is an array object,
its first item is the name of the message and its
second item is a class object to use as the starting point for the method
search. For more information, see
<xref linkend="meths1" />.</para>
<para>Any
<emphasis role="italic">argument</emphasis>s are passed to the receiver as
arguments for <emphasis role="italic">messagename</emphasis> in the order you
specify them.</para>
<para>When the receiver object has finished processing the message, the message
object retains its result and holds it until the sender requests it by sending
a <emphasis role="bold">result</emphasis> message. For further details,
see <xref linkend="mthMessageStart" />.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
world=.WorldObject~new
msg1=world~start("HELLO") /* same as next line */
msg2=.message~new(world,"HELLO")~~start /* same as previous line */
say msg1~result /* Produces Hello world 21:04:25.065000 */
/* for example */
say msg2~result /* Produces Hello world 21:04:25.081000 */
/* for example */
::class 'WorldObject' public
::method hello
return "Hello world" time('L')
</programlisting>
</section>
<section id="mthObjectStartWith"><title>startWith</title>
<indexterm><primary>startWith method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>startWith method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-startWith(messagename,arguments)--------------------------------><
]]>
</programlisting>
<para>Returns a message object (see
<xref linkend="clsMessage" />) and sends it a
<emphasis role="bold">start</emphasis> message
to start concurrent processing. The object receiving the message
<emphasis role="italic">messagename</emphasis> processes this message
concurrently with the sender's continued processing.</para>
<para>The <emphasis role="italic">messagename</emphasis> can be a string or
an array. If <emphasis role="italic">messagename</emphasis> is an array object,
its first item is the name of the message and its
second item is a class object to use as the starting point for the method
search. For more information, see
<xref linkend="meths1" />.</para>
<para>The <emphasis role="italic">arguments</emphasis> argument must be
a single-dimension array instance.
Any values contained in
<emphasis role="italic">arguments</emphasis> are passed to the receiver as
arguments for <emphasis role="italic">messagename</emphasis> in the order you
specify them.</para>
<para>When the receiver object has finished processing the message, the message
object retains its result and holds it until the sender requests it by sending
a <emphasis role="bold">result</emphasis> message. For further details,
see <xref linkend="mthMessageStart" />.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
world=.WorldObject~new
msg1=world~startWith("HELLO", .array~of("Fred") /* same as next line */
msg2=.message~new(world,"HELLO", 'i', .array~of("Fred"))~~start /* same as previous line */
say msg1~result /* Produces Hello Fred 21:04:25.065000 */
/* for example */
say msg2~result /* Produces Hello Fred 21:04:25.081000 */
/* for example */
::class 'WorldObject' public
::method hello
use arg name
return "Hello" name time('L')
</programlisting>
</section>
<section id="mthObjectString"><title>string</title>
<indexterm><primary>string method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>string method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-string------------------------------------------------------><
]]>
</programlisting>
<para>Returns a human-readable string representation of the object. The exact
form of this representation depends on the object and might not alone be
sufficient to reconstruct the object. All objects must be able to produce a
string representation of themselves in this way.</para>
<para>The object's string representation is obtained from the
<emphasis role="bold">objectName</emphasis>
method (which can in turn use the
<emphasis role="bold">defaultName</emphasis> method). See also the
<emphasis role="bold">objectName</emphasis>
method (<xref linkend="mthObjectObjectName" />) and the
<emphasis role="bold">defaultName</emphasis> method
(<xref linkend="mthObjectDefaultName" />).</para>
<para>The distinction between this method, the
<emphasis role="bold">makeString</emphasis> method (which obtains
string values&mdash;see <xref linkend="mthStringMakeString" />) and the
<emphasis role="bold">request</emphasis>
method (see <xref linkend="mthObjectRequest" />) is important. All objects
have a <emphasis role="bold">string</emphasis> method, which returns
a string representation (human-readable form) of the
object. This form is useful in tracing and debugging. Only those objects that
have information with a meaningful string form have a
<emphasis role="bold">makeString</emphasis> method to
return this value. For example, directory objects have a readable string
representation (a Directory), but no string value, and, therefore, no
<emphasis role="bold">makeString</emphasis> method.</para>
<para>Of the classes that Rexx provides, only the String class has a
<emphasis role="bold">makeString</emphasis>
method. Any subclasses of the String class inherit this method by default,
so these subclasses also have string values. Any other class can also provide
a string value by defining a <emphasis role="bold">makeString</emphasis> method.</para>
</section>
<section id="mthObjectUnsetMethod"><title>unsetMethod</title>
<indexterm><primary>unsetMethod method</primary>
<secondary>of Object class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>unsetMethod method</secondary>
<tertiary>of Object class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-unsetMethod(methodname)-------------------------------------><
]]>
</programlisting>
<para>Cancels the effect of all previous
<emphasis role="bold">setMethod</emphasis>s for method
<emphasis role="italic">methodname</emphasis>. It also removes any method
<emphasis role="italic">methodname</emphasis> introduced with
<emphasis role="italic">enhanced</emphasis>
when the object was created. If the object has received no
<emphasis role="bold">setMethod</emphasis> method,
no action is taken. </para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>The <emphasis role="bold">unsetMethod</emphasis>
method is a private method.
See the <emphasis role="bold">setPrivate</emphasis> method
in <xref linkend="mthMethodSetPrivate" /> for details.
</para>
</listitem>
<listitem><para>The <emphasis role="bold">unsetMethod</emphasis>
method is a protected method.</para></listitem>
</orderedlist>
</section>
</section>
<section id="clsClass"><title>The Class Class</title>
<indexterm><primary>Class class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Class class</secondary></indexterm>
<para>The Class class is like a factory that produces the factories that
produce objects. It is a subclass of the
Object class (<xref linkend="clsObject" />). The instance methods of the
Class class are also the class methods of all classes.</para>
<figure><title>The Class class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxClassClass.png" />
</imageobject>
</mediaobject>
</figure>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />).</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mthClassBaseClass"><title>baseClass</title>
<indexterm><primary>baseClass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>baseClass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-baseClass---------------------------------------------------><
]]>
</programlisting>
<para>Returns the base class associated with the class. If the class is a mixin
class, the base class is the first superclass that is not also a mixin class.
If the class is not a mixin class, the base class is the class receiving the
<emphasis role="bold">baseClass</emphasis> message.</para>
</section>
<section id="mthClassDefaultName"><title>defaultName</title>
<indexterm><primary>defaultName method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>defaultName method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-defaultName-------------------------------------------------><
]]>
</programlisting>
<para>Returns a short human-readable string representation of the class. The
string returned is of the form </para>
<programlisting>
The id class
</programlisting>
<para> where <emphasis role="italic">id</emphasis> is the identifier assigned
to the class when it was created.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>defaultName method</secondary></indexterm>
<programlisting>
say .array~defaultName /* Displays "The Array class" */
say .account~defaultName /* Displays "The ACCOUNT class" */
say .savings~defaultName /* Displays "The Savings class" */
::class account /* Name is all upper case */
::class "Savings" /* String name is mixed case */
</programlisting>
</section>
<section id="mthClassDefine"><title>define</title>
<indexterm><primary>define method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>define method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-define(methodname-+---------+-)-----------------------------><
+-,method-+
]]>
</programlisting>
<para>Incorporates the method object <emphasis role="italic">method</emphasis>
in the receiver class's collection of instance methods. The
method name <emphasis role="italic">methodname</emphasis> is translated to
to uppercase. Using the <emphasis role="bold">define</emphasis>
method replaces any existing definition for
<emphasis role="italic">methodname</emphasis> in the receiver class.</para>
<para>If you omit <emphasis role="italic">method</emphasis>, the method name
<emphasis role="italic">methodname</emphasis> is made
unavailable for the receiver class. Sending a message of that name
to an instance of the class causes the
<emphasis role="bold">unknown</emphasis> method (if any) to be run.</para>
<para>The <emphasis role="italic">method</emphasis> argument can be a string
containing a method source line instead of a method object. Alternatively, you
can pass an array of strings containing individual method lines. Either way,
<emphasis role="bold">define</emphasis> creates an equivalent method object.
</para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>The classes Rexx provides do not permit changes or additions to
their method definitions.</para></listitem>
<listitem><para>The <emphasis role="bold">define</emphasis>
method is a protected method.</para></listitem>
</orderedlist>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>define method</secondary></indexterm>
<programlisting>
bank_account=.object~subclass("Account")
bank_account~define("TYPE",&apos;return "a bank account"&apos;)
</programlisting>
</section>
<section id="mthClassDelete"><title>delete</title>
<indexterm><primary>delete method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>delete method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-delete(methodname)------------------------------------------><
]]>
</programlisting>
<para>Removes the receiver class's definition
for the method name <emphasis role="italic">methodname</emphasis>. If the
receiver class defined <emphasis role="italic">methodname</emphasis> as
unavailable with the <emphasis role="bold">define</emphasis>
method, this definition is
nullified. If the receiver class had no definition for
<emphasis role="italic">methodname</emphasis>, no action is taken. </para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>The classes Rexx provides do not permit changes or additions
to their method definitions.</para></listitem>
<listitem><para><emphasis role="bold">delete</emphasis>
deletes only methods the target class defines. You
cannot delete inherited methods the target's superclasses define.</para>
</listitem>
<listitem><para>The <emphasis role="bold">delete</emphasis>
method is a protected method.</para></listitem>
</orderedlist>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>delete method</secondary></indexterm>
<programlisting>
myclass=.object~subclass("Myclass") /* After creating a class */
myclass~define("TYPE",&apos;return "my class"&apos;) /* and defining a method */
myclass~delete("TYPE") /* this deletes the method */
</programlisting>
</section>
<section id="mthClassEnhanced"><title>enhanced</title>
<indexterm><primary>enhanced method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>enhanced method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-enhanced(methods-+---------------+-)------------------------><
| +-----------+ |
| V | |
+---,argument-+-+
]]>
</programlisting>
<para>Returns an enhanced new instance of the receiver class, with object
methods that are the instance methods of the class, enhanced by the methods in
the collection <emphasis role="italic">methods</emphasis>. The collection
indexes are the names of the enhancing
methods, and the items are the method objects (or strings or arrays of strings
containing method code). (See the description of
define (<xref linkend="mthClassDefine" />.)
You can use any collection that supports a
<emphasis role="bold">supplier</emphasis> method.</para>
<para><emphasis role="bold">enhanced</emphasis> sends an
<emphasis role="bold">init</emphasis> message to the created object, passing the
<emphasis role="italic">argument</emphasis>s specified on the
<emphasis role="bold">enhanced</emphasis> method.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>enhanced method</secondary></indexterm>
<programlisting>
/* Set up rclass with class method or methods you want in your */
/* remote class */
rclassmeths = .directory~new
rclassmeths["DISPATCH"]=d_source /* d_source must have code for a */
/* DISPATCH method. */
/* The following sends init("Remote Class") to a new instance */
rclass=.class~enhanced(rclassmeths,"Remote Class")
</programlisting>
</section>
<section id="mthClassId"><title>id</title>
<indexterm><primary>id method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>id method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-id----------------------------------------------------------><
]]>
</programlisting>
<para>Returns the class identity (instance) string. (This is the string that
is an argument on the <emphasis role="bold">subClass</emphasis> and
<emphasis role="bold">mixinClass</emphasis> methods.) The string
representations of the class and its instances contain the class identity.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>id method</secondary></indexterm>
<programlisting>
myobject=.object~subClass("my object") /* Creates a subclass */
say myobject~id /* Produces: "my object" */
</programlisting>
</section>
<section id="mthClassInherit"><title>inherit</title>
<indexterm><primary>inherit method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>inherit method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-inherit(classobj-+-----------+-)----------------------------><
+-,classpos-+
]]>
</programlisting>
<para>Causes the receiver class to inherit the instance and class methods of
the class object <emphasis role="italic">classobj</emphasis>. The
<emphasis role="italic">classpos</emphasis> is a class object
that specifies the position of the new superclass in the list of superclasses.
(You can use the <emphasis role="bold">superClasses</emphasis>
method to return the immediate superclasses.)
</para>
<para>The new superclass is inserted in the search order after the specified
class. If the <emphasis role="italic">classpos</emphasis> class is not found in
the set of superclasses, an error is raised. If you do not specify
<emphasis role="italic">classpos</emphasis>, the new superclass
is added to the end of the superclasses list.</para>
<para>Inherited methods can take precedence only over methods defined at or
above the base class of the <emphasis role="italic">classobj</emphasis> in the
class hierarchy. Any subsequent change to the instance methods of
<emphasis role="italic">classobj</emphasis> takes immediate effect
for all the classes that inherit from it.</para>
<para>The new superclass <emphasis role="italic">classobj</emphasis> must be
created with the <emphasis role="bold">mixinClass</emphasis>
option of the ::CLASS directive or the
<emphasis role="bold">mixinClass</emphasis> method and the base class
of the <emphasis role="italic">classobj</emphasis> must be a direct superclass
of the receiver object. The receiver must not already descend from
<emphasis role="italic">classobj</emphasis> in the class
hierarchy and vice versa.</para>
<para>The method search order of the receiver class after
<emphasis role="bold">inherit</emphasis> is the same
as before <emphasis role="bold">inherit</emphasis>, with the addition of
<emphasis role="italic">classobj</emphasis> and its superclasses
(if not already present). </para>
<para><emphasis role="bold">Notes:</emphasis></para>
<orderedlist>
<listitem><para>You cannot change the classes that Rexx provides by sending
<emphasis role="bold">inherit</emphasis> messages.</para></listitem>
<listitem><para>The <emphasis role="bold">inherit</emphasis>
method is a protected method.</para></listitem>
</orderedlist>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>inherit method</secondary></indexterm>
<programlisting>
room~inherit(.location)
</programlisting>
</section>
<section id="mthClassIsSubclassOf"><title>isSubClassOf</title>
<indexterm><primary>isSubclassOf method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isSubclassOf method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-isSubclassOf(class)-------------------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the object is a subclass of the specified
<emphasis role="italic">class</emphasis>.
Returns .false ("0") if the object is not a subclass of the specified
<emphasis role="italic">class</emphasis>.
A class is a subclass of a class if the target class is the same as
<emphasis role="italic">class</emphasis> or if
<emphasis role="italic">class</emphasis> is in the object's direct or mixin
class inheritance chain. For example:
<programlisting>
<![CDATA[
.String~isSubclassOf(.object) -> 1
.String~isSubclassOf(.mutablebuffer) -> 0
]]>
</programlisting>
</para>
</section>
<section id="mthClassMetaclass"><title>metaClass</title>
<indexterm><primary>metaClass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>metaClass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-metaClass---------------------------------------------------><
]]>
</programlisting>
<para>Returns the receiver class's default metaclass. This is the class used
to create subclasses of this class when you send
<emphasis role="bold">subClass</emphasis> or
<emphasis role="bold">mixinClass</emphasis> messages
(with no metaclass arguments).
The instance methods of the default metaclass are the class methods of the
receiver class. For more information about class methods, see
<xref linkend="objcla" />.
See also the description of the <emphasis role="bold">subClass</emphasis>
method in <xref linkend="mthClassSubclass" />.</para>
</section>
<section id="mthClassMethod"><title>method</title>
<indexterm><primary>method method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>method method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-method(methodname)------------------------------------------><
]]>
</programlisting>
<para>Returns the method object for the receiver class's definition for the
method name <emphasis role="italic">methodname</emphasis>. If the receiver
class defined <emphasis role="italic">methodname</emphasis> as unavailable,
this method returns the Nil object. If the receiver
class did not define <emphasis role="italic">methodname</emphasis>, an
error is raised.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>method method</secondary></indexterm>
<programlisting>
/* Create and retrieve the method definition of a class */
myclass=.object~subClass("My class") /* Create a class */
mymethod=.method~new(" ","Say arg(1)") /* Create a method object */
myclass~define("ECHO",mymethod) /* Define it in the class */
method_source = myclass~method("ECHO")~source /* Extract it */
say method_source /* Says "an Array" */
say method_source[1] /* Shows the method source code */
</programlisting>
</section>
<section id="mthClassMethods"><title>methods</title>
<indexterm><primary>methods method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>methods method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-methods-+----------------+----------------------------------><
+-(class_object)-+
]]>
</programlisting>
<para>Returns a Supplier object (<xref linkend="clsSupplier" />)
for all the instance methods of the receiver
class and its superclasses, if you specify no argument. If
<emphasis role="italic">class_object</emphasis> is the Nil object,
<emphasis role="bold">methods</emphasis>
returns a supplier object for only the instance
methods of the receiver class. If you specify a
<emphasis role="italic">class_object</emphasis>,
this method returns a supplier object containing only the instance methods
that <emphasis role="italic">class_object</emphasis> defines.
The supplier enumerates all the names and methods existing
at the time of the supplier's creation.
</para>
<note><title>Note</title>
<para>Methods that have been hidden with a
<emphasis role="bold">setMethod</emphasis> or
<emphasis role="bold">define</emphasis> method
are included with the other methods that
<emphasis role="bold">methods</emphasis> returns. The hidden methods
have the Nil object for the associated method.</para></note>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>methods method</secondary></indexterm>
<programlisting>
objsupp=.object~methods
do while objsupp~available
say objsupp~index -- displays all instance method
objsupp~next -- names of the Object class
end
</programlisting>
</section>
<section id="mthClassMixinClass"><title>mixinClass</title>
<indexterm><primary>mixinClass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>mixinClass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-mixinClass(classid-+-------------------------+-)------------><
+-,metaclass-+----------+-+
+-,methods-+
]]>
</programlisting>
<para>Returns a new mixin subclass of the receiver class. You can use this
method to create a new mixin class that is a subclass of the superclass to
which you send the message. The <emphasis role="italic">classid</emphasis>
is a string that identifies the new mixin subclass. You can use the
<emphasis role="bold">id</emphasis> method
to retrieve this string.</para>
<para>The <emphasis role="italic">metaclass</emphasis> is a class object. If
you specify <emphasis role="italic">metaclass</emphasis>, the new subclass is
an instance of <emphasis role="italic">metaclass</emphasis>. (A metaclass is a
class that you can use to create a class, that is, a class
whose instances are classes. The Class class and its subclasses are metaclasses.)
</para>
<para>If you do not specify a <emphasis role="italic">metaclass</emphasis>,
the new mixin subclass is an
instance of the default metaclass of the receiver class. For subclasses of
the Object class, the default metaclass is the Class class.</para>
<para>The <emphasis role="italic">methods</emphasis> is a collection whose
indexes are the names of methods
and whose items are method objects (or strings or arrays of strings containing
method code). If you specify <emphasis role="italic">methods</emphasis>, the new
class is enhanced with class methods from this collection. (The metaclass of
the new class is not affected.)</para>
<para>The <emphasis role="bold">metaClass</emphasis>
method returns the metaclass of a class.</para>
<para>The method search order of the new subclass is the same as that of the
receiver class, with the addition of the new subclass at the start of the
order.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>mixinClass method</secondary></indexterm>
<programlisting>
buyable=.object~mixinClass("Buyable") /* New subclass is buyable */
/* Superclass is Object class */
</programlisting>
</section>
<section id="mthClassNew"><title>new</title>
<indexterm><primary>new method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new-+---------------+---------------------------------------><
| +-,---+ |
| V | |
+-(----arg-+--)-+
]]>
</programlisting>
<para>Returns a new instance of the receiver class, whose object methods are
the instance methods of the class. This method initializes a new instance
by running its <emphasis role="bold">init</emphasis> methods. (See
<xref linkend="creo" />.)
<emphasis role="bold">new</emphasis> also sends an
<emphasis role="bold">init</emphasis> message. If you specify args,
<emphasis role="bold">new</emphasis> passes these
arguments on the <emphasis role="bold">init</emphasis> message.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>new method</secondary></indexterm>
<programlisting>
<![CDATA[
/* new method example */
a = .account~new /* -> Object variable balance=0 */
y = .account~new(340.78) /* -> Object variable balance=340.78 */
/* plus free toaster oven */
::class account subclass object
::method init /* Report time each account created */
/* plus free toaster when more than $100 */
Expose balance
Arg opening_balance
Say "Creating" self~objectName "at time" time()
If datatype(opening_balance, "N") then balance = opening_balance
else balance = 0
If balance > 100 then Say " You win a free toaster oven"
]]>
</programlisting>
</section>
<section id="mthClassQueryMixinClass"><title>queryMixinClass</title>
<indexterm><primary>queryMixinClass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>queryMixinClass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-queryMixinClass---------------------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> (true) if the class is a
mixin class, or <computeroutput>0</computeroutput> (false).</para>
</section>
<section id="mthClassSubclass"><title>subclass</title>
<indexterm><primary>subclass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>subclass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-subclass(classid-+-------------------------+-)--------------><
+-,metaclass-+----------+-+
+-,methods-+
]]>
</programlisting>
<para>Returns a new subclass of the receiver class. You can use this method to
create a new class that is a subclass of the superclass to which you send
the message. The <emphasis role="italic">classid</emphasis> is a string that
identifies the subclass. (You can use the
<emphasis role="bold">id</emphasis> method to retrieve this string.)
</para>
<para>The <emphasis role="italic">metaclass</emphasis> is a class object. If
you specify <emphasis role="italic">metaclass</emphasis>, the new subclass is
an instance of <emphasis role="italic">metaclass</emphasis>. (A metaclass is a
class that you can use to create a class, that is, a class
whose instances are classes. The Class class and its subclasses are metaclasses.)
</para>
<para>If you do not specify a <emphasis role="italic">metaclass</emphasis>,
the new subclass is an instance
of the default metaclass of the receiver class. For subclasses of the Object
class, the default metaclass is the Class class.</para>
<para>The <emphasis role="italic">methods</emphasis> is a collection whose
indexes are the names of methods
and whose items are method objects (or strings or arrays of strings containing
method code). If you specify <emphasis role="italic">methods</emphasis>,
the new class is enhanced with class methods from this collection.
(The metaclass of the new class is not affected.)</para>
<para>The <emphasis role="bold">metaclass</emphasis> method returns the
metaclass of a class.</para>
<para>The method search order of the new subclass is the same as that of the
receiver class, with the addition of the new subclass at the start of the
order.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>subClass method</secondary></indexterm>
<programlisting>
room=.object~subclass("Room") /* Superclass is .object */
/* Subclass is room */
/* Subclass identity is Room */
</programlisting>
</section>
<section id="mthClassSubclasses"><title>subclasses</title>
<indexterm><primary>subclasses method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>subclasses method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-subclasses--------------------------------------------------><
]]>
</programlisting>
<para>Returns the immediate subclasses of the receiver
class in the form of a single-index array of the required size, in an
unspecified order. (The program should not rely on any order.)
</para>
</section>
<section id="mthClassSuperClass"><title>superClass</title>
<indexterm><primary>superClass method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>superClass method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-superClass------------------------------------------------><
]]>
</programlisting>
<para>Returns the immediate superclass of the receiver class. The
immediate superclass is
the original class used on a <emphasis role="bold">subClass</emphasis> or a
<emphasis role="bold">mixinClass</emphasis> method. For the Object Class,
<emphasis role="bold">superClass</emphasis> returns .Nil.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>superClass method</secondary></indexterm>
<programlisting>
say .object~superclass -- displays "The Nil object"
say .class~superclass -- displays "The Object class"
say .set~superclass -- displays "The Table class"
</programlisting>
</section>
<section id="mthClassSuperClasses"><title>superClasses</title>
<indexterm><primary>superClasses method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>superClasses method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-superClasses------------------------------------------------><
]]>
</programlisting>
<para>Returns the immediate superclasses of the receiver class in the form of
a single-index array of the required size. The immediate superclasses are
the original class used on a <emphasis role="bold">subClass</emphasis> or a
<emphasis role="bold">mixinClass</emphasis> method, plus any additional
superclasses defined with the <emphasis role="bold">inherit</emphasis>
method. The array is in the order in
which the class has inherited the classes. The original class used on a
<emphasis role="bold">subClass</emphasis> or
<emphasis role="bold">mixinClass</emphasis> method is the first item of the
array.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>superClasses method</secondary></indexterm>
<programlisting>
z=.class~superClasses
/* To obtain the information this returns, you could use: */
do i over z
say i
end
</programlisting>
</section>
<section id="mthClassUninherit"><title>uninherit</title>
<indexterm><primary>uninherit method</primary>
<secondary>of Class class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>uninherit method</secondary>
<tertiary>of Class class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-uninherit(classobj)-----------------------------------------><
]]>
</programlisting>
<para>Nullifies the effect of any previous
<emphasis role="bold">inherit</emphasis> message
sent to the receiver for the class <emphasis role="italic">classobj</emphasis>.
</para>
<note><title>Note</title>
<para>You cannot change the classes that Rexx provides by sending
<emphasis role="bold">uninherit</emphasis> messages.
</para></note>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>uninherit method</secondary></indexterm>
<programlisting>
location=.object~mixinClass("Location")
room=.object~subclass("Room")~~inherit(location) /* Creates subclass */
/* and specifies inheritance */
room~uninherit(location)
</programlisting>
</section>
</section>
<section id="clsString"><title>The String Class</title>
<indexterm><primary>String class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>String class</secondary></indexterm>
<para>String objects represent character-string data values. A character
string value can have any length and contain any characters.
</para>
<figure><title>The String class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxStringClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The String class also has available class methods that its
metaclass, the Class class (<xref linkend="clsClass" />, defines.
</para></note>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />.</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<para>Methods inherited from the
Comparable class (<xref linkend="clsComparable" />.</para>
<itemizedlist>
<listitem><para>compareTo (<xref linkend="mthComparableCompareTo" /></para></listitem>
</itemizedlist>
</section>
<section id="mthStringNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new(stringvalue)--------------------------------------------><
]]>
</programlisting>
<para>Returns a new string object initialized with the characters in
<emphasis role="italic">stringvalue</emphasis>.</para>
</section>
<section id="mthStringArithmeticMethods"><title>Arithmetic Methods</title>
<indexterm><primary>method</primary>
<secondary>arithmetic methods</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-arithmetic_operator(argument)-------------------------------><
]]>
</programlisting>
<note><title>Note</title>
<para>The syntax diagram above is for the non-prefix operators. The prefix + and
<emphasis role="italic">argument</emphasis>.</para></note>
<para>Returns the result of performing the specified arithmetic operation on
the receiver object. The receiver object and the
<emphasis role="italic">argument</emphasis> must be
valid numbers (see <xref linkend="numbrs" />). The
<emphasis role="italic">arithmetic_operator</emphasis> can be:
</para>
<informaltable frame="none" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
<colspec colnum="2" colwidth="4*" />
<tbody>
<row><entry>+
<indexterm><primary>+ method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>+</secondary></indexterm>
</entry>
<entry><para>Addition
</para></entry></row>
<row><entry>-
<indexterm><primary>- method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>-</secondary></indexterm>
</entry>
<entry><para>Subtraction
</para></entry></row>
<row><entry>*
<indexterm><primary>* method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>*</secondary></indexterm>
</entry>
<entry><para>Multiplication
</para></entry></row>
<row><entry>/
<indexterm><primary>/ method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>/</secondary></indexterm>
</entry>
<entry><para>Division
</para></entry></row>
<row><entry>%
<indexterm><primary>% method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>%</secondary></indexterm>
</entry>
<entry><para>Integer division (divide and return the integer part of the
result)</para></entry></row>
<row><entry>//
<indexterm><primary>// method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>//</secondary></indexterm>
</entry>
<entry><para>Remainder (divide and return the remainder&mdash;not modulo, because
the result can be negative)
</para></entry></row>
<row><entry>**
<indexterm><primary>** method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>**</secondary></indexterm>
</entry>
<entry><para>Exponentiation (raise a number to a whole-number power)
</para></entry></row>
<row><entry>Prefix -
<indexterm><primary>method</primary>
<secondary>prefix -</secondary></indexterm>
</entry>
<entry><para>Same as the subtraction:
<computeroutput>0 - number</computeroutput>
</para></entry></row>
<row><entry>Prefix +
<indexterm><primary>method</primary>
<secondary>prefix +</secondary></indexterm>
</entry>
<entry><para>Same as the addition:
<computeroutput>0 + number</computeroutput>
</para></entry></row>
</tbody>
</tgroup>
</informaltable>
<para>See <xref linkend="numarit" /> for details
about precision, the format of valid
numbers, and the operation rules for arithmetic. Note that if an arithmetic
result is shown in exponential notation, it might have been rounded.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>arithmetic methods of String class</secondary></indexterm>
<programlisting>
<![CDATA[
5+5 -> 10
8-5 -> 3
5*2 -> 10
6/2 -> 3
9//4 -> 1
9%4 -> 2
2**3 -> 8
+5 -> 5 /* Prefix + */
-5 -> -5 /* Prefix - */
]]>
</programlisting>
</section>
<section id="mthStringComparisonMethods"><title>Comparison Methods</title>
<indexterm><primary>method</primary>
<secondary>comparison methods</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-comparison_operator(argument)-------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> (true) or
<computeroutput>0</computeroutput> (false), the result of performing
the specified comparison operation. The receiver object and the
<emphasis role="italic">argument</emphasis> are the terms compared. Both must
be string objects.
If <emphasis role="italic">argument</emphasis> is not a string object, it is converted
to its string representation for the comparison.
The one exception is when <emphasis role="italic">argument</emphasis> is the Nil object
for the ==, \==, =, \=, &gt;&lt;, and &lt;&gt; operators.
A string object will never compare equal to the Nil object, even when the
string matches the string value of the Nil object ("The Nil object").
As a result, == will always return
0 (false) when compared to the Nil object and \== will always return 1
(true). All of the relational comparisions (for example, &lt;, &gt;,
&lt;=, etc.) will always return .false when compared to the Nil object.
</para>
<para>The comparison operators you can use in a message are: </para>
<informaltable frame="none" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
<colspec colnum="2" colwidth="4*" />
<tbody>
<row><entry>=
<indexterm><primary>= method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>=</secondary>
<tertiary>of String class</tertiary></indexterm>
</entry>
<entry><para>True if the terms are equal (for example, numerically or when
padded). False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>\=, &gt;&lt;, &lt;&gt;
<indexterm><primary>>&lt; method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>&gt;&lt; method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>&lt;&gt; method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>\=</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>>&lt;</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;&gt;</secondary>
<tertiary>of String class</tertiary></indexterm>
</entry>
<entry><para>True if the terms are not equal (inverse of =). True if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>&gt;
<indexterm><primary>&gt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>></secondary></indexterm>
</entry>
<entry><para>Greater than. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>&lt;
<indexterm><primary>&lt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;</secondary></indexterm>
</entry>
<entry><para>Less than. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>&gt;=
<indexterm><primary>&gt;= method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&gt;=</secondary></indexterm>
</entry>
<entry><para>Greater than or equal to. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>\&lt;
<indexterm><primary>\&lt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>\&lt;</secondary></indexterm>
</entry>
<entry><para>Not less than. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>&lt;=
<indexterm><primary>&lt;= method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;=</secondary></indexterm>
</entry>
<entry><para>Less than or equal to. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
<row><entry>\&gt;
<indexterm><primary>\&gt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>\&gt;</secondary></indexterm>
</entry>
<entry><para>Not greater than. False if <emphasis role="italic">argument</emphasis> is the Nil object.
</para></entry></row>
</tbody>
</tgroup>
</informaltable>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>comparison methods of String class</secondary></indexterm>
<programlisting>
<![CDATA[
5=5 -> 1 /* equal */
42\=41 -> 1 /* All of these are */
42><41 -> 1 /* "not equal" */
42<>41 -> 1
13>12 -> 1 /* Variations of */
12<13 -> 1 /* less than and */
13>=12 -> 1 /* greater than */
12\<13 -> 0
12<=13 -> 1
12\>13 -> 1
]]>
</programlisting>
<para>All strict comparison operations have one of the characters doubled that
define the operator. The <computeroutput>==</computeroutput> and
<computeroutput>\==</computeroutput> operators check
whether two strings match exactly. The two strings must be identical (character
by character) and of the same length to be considered strictly equal.</para>
<para>The strict comparison operators such as
<computeroutput>>></computeroutput> or
<computeroutput>&lt;&lt;</computeroutput> carry out a simple
character-by-character comparison. There is no padding
of either of the strings being compared. The comparison of the two strings
is from left to right. If one string is shorter than and a leading substring
of another, then it is smaller than (less than) the other. The strict
comparison operators do not attempt to perform a numeric comparison on the
two operands.</para>
<para>For all the other comparison operators, if both terms
are numeric, the String class does a numeric comparison (ignoring, for
example, leading zeros&mdash; see <xref linkend="numcom" />).
Otherwise, it treats
both terms as character strings, ignoring leading and trailing whitespace
characters and padding the shorter string on the right with blanks.
</para>
<para>Character comparison and strict comparison operations are both
case-sensitive,
and for both the exact collating order can depend on the character set. In
an ASCII environment, the digits are lower than the alphabetic characters,
and lowercase alphabetic characters are higher than uppercase alphabetic
characters.</para>
<para>The strict comparison operators you can use in a message are: </para>
<informaltable frame="none" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
<colspec colnum="2" colwidth="4*" />
<tbody>
<row><entry>==
<indexterm><primary>== method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>==</secondary>
<tertiary>of String class</tertiary></indexterm>
</entry>
<entry><para>True if terms are strictly equal (identical)
</para></entry></row>
<row><entry>\==
<indexterm><primary>\== method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>\==</secondary>
<tertiary>of String class</tertiary></indexterm>
</entry>
<entry><para>True if the terms are NOT strictly equal (inverse of ==)
</para></entry></row>
<row><entry>&gt;&gt;
<indexterm><primary>&gt;&gt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>>></secondary></indexterm>
</entry>
<entry><para>Strictly greater than
</para></entry></row>
<row><entry>&lt;&lt;
<indexterm><primary>&lt;&lt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;&lt;</secondary></indexterm>
</entry>
<entry><para>Strictly less than
</para></entry></row>
<row><entry>&gt;&gt;=
<indexterm><primary>&gt;&gt;= method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&gt;&gt;=</secondary></indexterm>
</entry>
<entry><para>Strictly greater than or equal to
</para></entry></row>
<row><entry>\&lt;&lt;
<indexterm><primary>\&lt;&lt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>\&lt;&lt;</secondary></indexterm>
</entry>
<entry><para>Strictly NOT less than
</para></entry></row>
<row><entry>&lt;&lt;=
<indexterm><primary>&lt;&lt;= method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&lt;&lt;=</secondary></indexterm>
</entry>
<entry><para>Strictly less than or equal to
</para></entry></row>
<row><entry>\&gt;&gt;
<indexterm><primary>\&gt;&gt; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>\&gt;&gt;</secondary></indexterm>
</entry>
<entry><para>Strictly NOT greater than
</para></entry></row>
</tbody>
</tgroup>
</informaltable>
<para><emphasis role="bold">Examples:</emphasis></para>
<programlisting>
<![CDATA[
"space"=="space" -> 1 /* Strictly equal */
"space"\==" space" -> 1 /* Strictly not equal */
"space">>" space" -> 1 /* Variations of */
" space"<<"space" -> 1 /* strictly greater */
"space">>=" space" -> 1 /* than and less than */
"space"\<<" space" -> 1
" space"<<="space" -> 1
" space"\>>"space" -> 1
]]>
</programlisting>
</section>
<section id="mthStringLogicalMethods"><title>Logical Methods</title>
<indexterm><primary>method</primary>
<secondary>logical methods</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-logical_operator(argument)----------------------------------><
]]>
</programlisting>
<note><title>Note</title>
<para>For NOT (prefix \),
<indexterm><primary>\ method</primary></indexterm>
omit the parentheses and <emphasis role="italic">argument</emphasis>.</para>
<para>Returns <computeroutput>1</computeroutput> (true) or
<computeroutput>0</computeroutput> (false), the result of performing
the specified logical operation. The receiver object and the
<emphasis role="italic">argument</emphasis> are character strings that
evaluate to <computeroutput>1</computeroutput> or
<computeroutput>0</computeroutput>.</para>
</note>
<para>The <emphasis role="italic">logical_operator</emphasis> can be: </para>
<informaltable frame="none" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
<colspec colnum="2" colwidth="4*" />
<tbody>
<row><entry>&amp;
<indexterm><primary>&amp; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&amp;</secondary></indexterm>
</entry>
<entry><para>AND (Returns <computeroutput>1</computeroutput>
if both terms are true.)
</para></entry></row>
<row><entry>|
<indexterm><primary>| method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>|</secondary></indexterm>
</entry>
<entry><para>Inclusive OR (Returns <computeroutput>1</computeroutput>
if either term or both terms are
true.)
</para></entry></row>
<row><entry>&amp;&amp;
<indexterm><primary>&amp;&amp; method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>&amp;&amp;</secondary></indexterm>
</entry>
<entry><para>Exclusive OR (Returns <computeroutput>1</computeroutput>
if either term, but not both terms,
is true.)
</para></entry></row>
<row><entry>Prefix \
<indexterm><primary>method</primary>
<secondary>\</secondary></indexterm>
</entry>
<entry><para>Logical NOT (Negates; <computeroutput>1</computeroutput>
becomes <computeroutput>0</computeroutput>, and
<computeroutput>0</computeroutput> becomes <computeroutput>1</computeroutput>.)
</para></entry></row>
</tbody>
</tgroup>
</informaltable>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>logical methods of String class</secondary></indexterm>
<programlisting>
<![CDATA[
1&0 -> 0
1|0 -> 1
1&&0 -> 1
\1 -> 0
]]>
</programlisting>
</section>
<section id="mthStringConcatenationMethods"><title>Concatenation Methods</title>
<indexterm><primary>method</primary>
<secondary>concatenation methods</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-concatenation_operator(argument)----------------------------><
]]>
</programlisting>
<para>Concatenates the receiver object with
<emphasis role="italic">argument</emphasis>. (See
<xref linkend="strgcon" />.)
The <emphasis role="italic">concatenation_operator</emphasis> can be: </para>
<informaltable frame="none" colsep="0" rowsep="0" pgwide="1">
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
<colspec colnum="2" colwidth="4*" />
<tbody>
<row><entry>&quot;&quot;</entry>
<entry><para>concatenates without an intervening blank. The abuttal operator
&quot;&quot;
is the null string. The language processor uses the abuttal to concatenate
two terms that another operator does not separate.
</para></entry></row>
<row><entry>||
<indexterm><primary>|| method</primary></indexterm>
<indexterm><primary>method</primary>
<secondary>||</secondary></indexterm>
</entry>
<entry><para>concatenates without an intervening blank.
</para></entry></row>
<row><entry>&quot;&nbsp;&quot;
</entry>
<entry><para>concatenates with one blank between the receiver
object and the <emphasis role="italic">argument</emphasis>.
(The operator &quot;&nbsp;&quot; is a blank.)
</para></entry></row>
</tbody>
</tgroup>
</informaltable>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>concatenation methods of String class</secondary></indexterm>
<indexterm><primary>prefix - method</primary></indexterm>
<indexterm><primary>prefix + method</primary></indexterm>
<programlisting>
<![CDATA[
f = "abc"
f"def" -> "abcdef"
f || "def" -> "abcdef"
f "def" -> "abc def"
]]>
</programlisting>
</section>
<section id="mthStringAbbrev"><title>abbrev</title>
<indexterm><primary>abbrev method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>abbrev method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>default</primary>
<secondary>selecting with abbrev method</secondary></indexterm>
<indexterm><primary>selecting a default with abbrev method</primary></indexterm>
<indexterm><primary>testing</primary>
<secondary>abbreviations with abbrev method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-abbrev(info-+---------+-)-----------------------------------><
+-,length-+
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> if
<emphasis role="italic">info</emphasis> is equal to the leading characters
of the receiving string and the length of
<emphasis role="italic">info</emphasis> is not less than
<emphasis role="italic">length</emphasis>. Returns
<computeroutput>0</computeroutput> if either of these conditions is not met.
</para>
<para>If you specify <emphasis role="italic">length</emphasis>, it must be a
positive whole number or zero. The default for
<emphasis role="italic">length</emphasis> is the number of characters in
<emphasis role="italic">info</emphasis>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>abbrev method</secondary></indexterm>
<programlisting>
<![CDATA[
"Print"~abbrev("Pri") -> 1
"PRINT"~abbrev("Pri") -> 0
"PRINT"~abbrev("PRI",4) -> 0
"PRINT"~abbrev("PRY") -> 0
"PRINT"~abbrev("") -> 1
"PRINT"~abbrev("",1) -> 0
]]>
</programlisting>
<note><title>Note</title>
<para>A null string always matches if a length of
<computeroutput>0</computeroutput>, or the
default, is used. This allows a default keyword to be selected automatically
if desired.</para></note>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
say "Enter option:"; pull option .
select /* keyword1 is to be the default */
when "keyword1"~abbrev(option) then ...
when "keyword2"~abbrev(option) then ...
...
otherwise nop;
end;
</programlisting>
</section>
<section id="mthStringAbs"><title>abs</title>
<indexterm><primary>abs method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>abs method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>absolute value</primary>
<secondary>finding using the abs method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-abs---------------------------------------------------------><
]]>
</programlisting>
<para>Returns the absolute value of the receiving string. The result has no
sign and is formatted according to the current NUMERIC settings.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>abs method</secondary></indexterm>
<programlisting>
12.3~abs -> 12.3
"-0.307"~abs -> 0.307
</programlisting>
</section>
<section id="mthStringB2x"><title>b2x</title>
<indexterm><primary>b2x method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>b2x method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>binary</primary>
<secondary>to hexadecimal conversion</secondary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>binary to hexadecimal</secondary></indexterm>
<indexterm><primary>unpacking a string</primary>
<secondary>with b2x</secondary></indexterm>
<programlisting>
<![CDATA[
>>-b2x---------------------------------------------------------><
]]>
</programlisting>
<para>Returns a string, in character format, that represents the receiving
binary string converted to hexadecimal.</para>
<para>The receiving string is a string of binary
(<computeroutput>0</computeroutput> or <computeroutput>1</computeroutput>)
digits. It can be of any length. It can optionally include whitespace characters
(at 4-digit boundaries only, not leading or trailing). These are to improve
readability and are ignored.
</para>
<para>The returned string uses uppercase alphabetic characters for the values
<computeroutput>A</computeroutput>-<computeroutput>F</computeroutput> and does
not include whitespace.</para>
<para>If the receiving binary string is a null string,
<emphasis role="bold">b2x</emphasis> returns a null string.
If the number of binary digits in the receiving string is not a multiple of
four, up to three <computeroutput>0</computeroutput>
digits are added on the left
before the conversion to make a total that is a multiple of four.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>b2x method</secondary></indexterm>
<programlisting>
<![CDATA[
"11000011"~b2x -> "C3"
"10111"~b2x -> "17"
"101"~b2x -> "5"
"1 1111 0000"~b2x -> "1F0"
]]>
</programlisting>
<para>You can combine <emphasis role="bold">b2x</emphasis>
with the methods <emphasis role="bold">x2d</emphasis> and
<emphasis role="bold">x2c</emphasis> to convert a binary
number into other forms.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>"10111"~b2x~x2d -> "23" /* decimal 23 */</programlisting>
</section>
<section id="mthStringBitAnd"><title>bitAnd</title>
<indexterm><primary>bitAnd method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>bitAnd method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>ANDing character strings</primary></indexterm>
<indexterm><primary>character</primary>
<secondary>strings, ANDing</secondary></indexterm>
<programlisting>
<![CDATA[
>>-bitAnd-+--------------------+-------------------------------><
+-(string-+------+-)-+
+-,pad-+
]]>
</programlisting>
<para>Returns a string composed of the receiver string and the argument
<emphasis role="italic">string</emphasis> logically ANDed together,
bit by bit. (The encodings of the strings
are used in the logical operation.) The length of the result is the length
of the longer of the two strings. If you omit the
<emphasis role="italic">pad</emphasis> character,
the AND operation stops when the shorter of the two strings is exhausted,
and the unprocessed portion of the longer string is appended to the partial
result. If you provide <emphasis role="italic">pad</emphasis>,
it extends the shorter of the two strings
on the right before the logical operation. The default for
<emphasis role="italic">string</emphasis> is
the zero-length (null) string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>bitAnd method</secondary></indexterm>
<programlisting>
<![CDATA[
"12"x~bitAnd -> "12"x
"73"x~bitAnd("27"x) -> "23"x
"13"x~bitAnd("5555"x) -> "1155"x
"13"x~bitAnd("5555"x,"74"x) -> "1154"x
"pQrS"~bitAnd(,"DF"x) -> "PQRS" /* ASCII */
]]>
</programlisting>
</section>
<section id="mthStringBitOr"><title>bitOr</title>
<indexterm><primary>bitOr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>bitOr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>character</primary>
<secondary>strings, ORing</secondary></indexterm>
<indexterm><primary>ORing character together</primary></indexterm>
<programlisting>
<![CDATA[
>>-bitOr-+--------------------+--------------------------------><
+-(string-+------+-)-+
+-,pad-+
]]>
</programlisting>
<para>Returns a string composed of the receiver string and the argument
<emphasis role="italic">string</emphasis> logically inclusive-ORed, bit by bit.
The encodings of the strings
are used in the logical operation. The length of the result is the length
of the longer of the two strings. If you omit the
<emphasis role="italic">pad</emphasis> character,
the OR operation stops when the shorter of the two strings is exhausted, and
the unprocessed portion of the longer string is appended to the partial result.
If you provide <emphasis role="italic">pad</emphasis>, it extends the shorter
of the two strings on the right before the logical operation. The default for
<emphasis role="italic">string</emphasis> is
the zero-length (null) string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>bitOr method</secondary></indexterm>
<programlisting>
<![CDATA[
"12"x~bitOr -> "12"x
"15"x~bitOr("24"x) -> "35"x
"15"x~bitOr("2456"x) -> "3556"x
"15"x~bitOr("2456"x,"F0"x) -> "35F6"x
"1111"x~bitOr(,"4D"x) -> "5D5D"x
"pQrS"~bitOr(,"20"x) -> "pqrs" /* ASCII */
]]>
</programlisting>
</section>
<section id="mthStringBitXor"><title>bitXor</title>
<indexterm><primary>bitXor method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>bitXor method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>character</primary>
<secondary>strings, exclusive-ORing</secondary></indexterm>
<indexterm><primary>exclusive-ORing character strings together</primary>
</indexterm>
<indexterm><primary>XORing character strings together</primary></indexterm>
<programlisting>
<![CDATA[
>>-bitXor-+--------------------+-------------------------------><
+-(string-+------+-)-+
+-,pad-+
]]>
</programlisting>
<para>Returns a string composed of the receiver string and the argument
<emphasis role="italic">string</emphasis> logically eXclusive-ORed, bit by bit.
The encodings of the strings
are used in the logical operation. The length of the result is the length
of the longer of the two strings. If you omit the
<emphasis role="italic">pad</emphasis> character,
the XOR operation stops when the shorter of the two strings is exhausted,
and the unprocessed portion of the longer string is appended to the partial
result. If you provide <emphasis role="italic">pad</emphasis>,
it extends the shorter of the two strings
on the right before carrying out the logical operation. The default for
<emphasis role="italic">string</emphasis> is the zero-length (null) string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>bitXor method</secondary></indexterm>
<programlisting>
<![CDATA[
"12"x~bitXor -> "12"x
"12"x~bitXor("22"x) -> "30"x
"1211"x~bitXor("22"x) -> "3011"x
"1111"x~bitXor("444444"x) -> "555544"x
"1111"x~bitXor("444444"x,"40"x) -> "555504"x
"1111"x~bitXor(,"4D"x) -> "5C5C"x
"C711"x~bitXor("222222"x," ") -> "E53302"x /* ASCII */
]]>
</programlisting>
</section>
<section id="mthStringC2d"><title>c2d</title>
<indexterm><primary>c2d method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>c2d method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>character</primary>
<secondary>to decimal conversion</secondary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>character to decimal</secondary></indexterm>
<programlisting>
<![CDATA[
>>-c2d-+-----+-------------------------------------------------><
+-(n)-+
]]>
</programlisting>
<para>Returns the decimal value of the binary representation of the receiving
string. If the result cannot be expressed as a whole number, an error results.
That is, the result must not have more digits than the current setting of
NUMERIC DIGITS. If you specify <emphasis role="italic">n</emphasis>, it is the
length of the returned result. If you do not specify
<emphasis role="italic">n</emphasis>, the receiving string is processed
as an unsigned binary number. If the receiving string is null, C2D returns
<computeroutput>0</computeroutput>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>c2d method</secondary></indexterm>
<programlisting>
<![CDATA[
"09"X~c2d -> 9
"81"X~c2d -> 129
"FF81"X~c2d -> 65409
""~c2d -> 0
"a"~c2d -> 97 /* ASCII */
]]>
</programlisting>
<para>If you specify <emphasis role="italic">n</emphasis>, the receiving string
is taken as a signed number expressed in <emphasis role="italic">n</emphasis>
characters. The number is positive if the leftmost bit is off, and negative
if the leftmost bit is on. In both cases, it is converted
to a whole number, which can therefore be negative. The receiving string is
padded on the left with "00"x characters (not &quot;sign-extended&quot;),
or truncated on the left to <emphasis role="italic">n</emphasis> characters.
This padding or truncation is as though
<computeroutput>receiving_string~right(n,&apos;00&apos;x)</computeroutput> had
been processed. If <emphasis role="italic">n</emphasis> is
<computeroutput>0</computeroutput>,
<emphasis role="bold">c2d</emphasis> always returns
<computeroutput>0</computeroutput>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<programlisting>
<![CDATA[
"81"X~c2d(1) -> -127
"81"X~c2d(2) -> 129
"FF81"X~c2d(2) -> -127
"FF81"X~c2d(1) -> -127
"FF7F"X~c2d(1) -> 127
"F081"X~c2d(2) -> -3967
"F081"X~c2d(1) -> -127
"0031"X~c2d(0) -> 0
]]>
</programlisting>
</section>
<section id="mthStringC2x"><title>c2x</title>
<indexterm><primary>c2x method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>c2x method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>character</primary>
<secondary>to hexadecimal conversion</secondary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>character to hexadecimal</secondary></indexterm>
<indexterm><primary>unpacking a string</primary>
<secondary>with c2x</secondary></indexterm>
<programlisting>
<![CDATA[
>>-c2x---------------------------------------------------------><
]]>
</programlisting>
<para>Returns a string, in character format, that represents the receiving
string converted to hexadecimal. The returned string contains twice as many
bytes as the receiving string. On an ASCII system, sending a
<emphasis role="bold">c2x</emphasis> message to the
receiving string <computeroutput>1</computeroutput> returns
<computeroutput>31</computeroutput> because "31"X
is the ASCII representation of <computeroutput>1</computeroutput>.</para>
<para>The returned string has uppercase alphabetic characters for the values
<computeroutput>A</computeroutput>-<computeroutput>F</computeroutput> and does
not include whitespace. The receiving string can be of any length. If the
receiving string is null,
<emphasis role="bold">c2x</emphasis> returns a null string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>c2x method</secondary></indexterm>
<programlisting>
<![CDATA[
"0123"X~c2x -> "0123" /* "30313233"X in ASCII */
"ZD8"~c2x -> "5A4438" /* "354134343338"X in ASCII */
]]>
</programlisting>
</section>
<section id="mthStringCaselessAbbrev"><title>caselessAbbrev</title>
<indexterm><primary>caselessAbbrev method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessAbbrev method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>default</primary>
<secondary>selecting with caselessAbbrev method</secondary></indexterm>
<indexterm><primary>selecting a default with caselessAbbrev
method</primary></indexterm>
<indexterm><primary>testing</primary>
<secondary>abbreviations with caselessAbbrev
method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-caselessAbbrev(info-+---------+-)-----------------------------------><
+-,length-+
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> if
<emphasis role="italic">info</emphasis> is equal to the leading
characters
of the receiving string and the length of
<emphasis role="italic">info</emphasis> is not less than
<emphasis role="italic">length</emphasis>. Returns
<computeroutput>0</computeroutput> if either of these conditions is not
met.
The characters are tested using a caseless comparison.
</para>
<para>If you specify <emphasis role="italic">length</emphasis>, it must be
a
positive whole number or zero. The default for
<emphasis role="italic">length</emphasis> is the number of characters in
<emphasis role="italic">info</emphasis>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>abbrev method</secondary></indexterm>
<programlisting>
<![CDATA[
"Print"~caselessAbbrev("Pri") -> 1
"PRINT"~caselessAbbrev("Pri") -> 1
"PRINT"~caselessAbbrev("PRI",4) -> 0
"PRINT"~caselessAbbrev("PRY") -> 0
"PRINT"~caselessAbbrev("") -> 1
"PRINT"~caselessAbbrev("",1) -> 0
]]>
</programlisting>
<note><title>Note</title>
<para>A null string always matches if a length of
<computeroutput>0</computeroutput>, or the
default, is used. This allows a default keyword to be selected
automatically
if desired.</para></note>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
say "Enter option:"; parse pull option .
select /* keyword1 is to be the default */
when "keyword1"~caselessAbbrev(option) then ...
when "keyword2"~caselessAbbrev(option) then ...
...
otherwise nop;
end;
</programlisting>
</section>
<section id="mthStringCaselessChangeStr"><title>caselessChangeStr</title>
<indexterm><primary>caselessChangeStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessChangeStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessChangeStr(needle,newneedle--+--------+--)---------------------------------><
+-,count-+
]]>
</programlisting>
<para>Returns a copy of the receiver object in which
<emphasis role="italic">newneedle</emphasis> replaces
occurrences of <emphasis role="italic">needle</emphasis>.
If <emphasis role="italic">count</emphasis> is not specified, all occurrences of
<emphasis role="italic">needle</emphasis> are replaced. If <emphasis role="italic">count</emphasis>
is specified, it must be a positive, whole number that gives the maximum number of
occurrences to be replaced.
The <emphasis role="italic">needle</emphasis> searches are performed
using caseless comparisons.
</para>
<para>Here are some examples:</para>
<indexterm><primary>examples</primary>
<secondary>caselessChangeStr method</secondary></indexterm>
<programlisting>
<![CDATA[
"AbaAbb"~caselessChangeStr("A","") -> "bbb"
AbaBabAB~changeStr("ab","xy") -> "xyxyxyxy"
AbaBabAB~changeStr("ab","xy",1) -> "xyaBabAB"
]]>
</programlisting>
</section>
<section id="mthStringCaselessCompare"><title>caselessCompare</title>
<indexterm><primary>caselessCompare method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>compare method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>comparisons</primary>
<secondary>of strings</secondary></indexterm>
<indexterm><primary>finding</primary>
<secondary>mismatch using caselessCompare</secondary></indexterm>
<programlisting>
<![CDATA[
>>-caselessCompare(string-+------+-)-----------------------------------><
+-,pad-+
]]>
</programlisting>
<para>Returns <computeroutput>0</computeroutput> if the argument
<emphasis role="italic">string</emphasis> is identical to the
receiving string using a caseless comparison.
Otherwise, returns the position of the first character that
does not match. The shorter string is padded on the right with
<emphasis role="italic">pad</emphasis> if
necessary. The default <emphasis role="italic">pad</emphasis> character is
a
blank.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>compare method</secondary></indexterm>
<programlisting>
<![CDATA[
"abc"~caselessCompare("ABC") -> 0
"abc"~caselessCompare("Ak") -> 2
"ab "~caselessCompare("AB") -> 0
"AB "~caselessCompare("ab"," ") -> 0
"ab "~caselessCompare("ab","x") -> 3
"abXX "~caselessCompare("ab","x") -> 5
]]>
</programlisting>
</section>
<section id="mthStringCaselessCompareTo"><title>caselessCompareTo</title>
<indexterm><primary>caselessCompareTo method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessCompareTo method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessCompareTo method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessCompareTo method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessCompareTo(string-+-----------------------+-)----------------------><
+-,--+---+--+---------+-+
+-n-+ +-,length-+
]]>
</programlisting>
<para>Performs a caseless sort comparison of the target string to the
<emphasis role="italic">string</emphasis> argument. If the
two strings are equal, <computeroutput>0</computeroutput> is returned. If
the target string is larger, <computeroutput>1</computeroutput> is returned.
<computeroutput>-1</computeroutput> if the <emphasis role="italic">string</emphasis>
argument is the larger string.
The comparison is performed starting at character <emphasis role="italic">n</emphasis>
for <emphasis role="italic">length</emphasis> characters in both strings.
<emphasis role="italic">n</emphasis> must be a positive whole number. If <emphasis role="italic">n</emphasis>
is omitted, the comparison starts at the first character.
<emphasis role="italic">length</emphasis> must be a non-negative whole number. If omitted, the comparison will take
place to the end of the target string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessCompareTo method</secondary></indexterm>
<programlisting>
<![CDATA[
"abc"~caselessCompareTo("abc") -> 0
"b"~caselessCompareTo("a") -> 1
"a"~caselessCompareTo("b") -> -1
"abc"~caselessCompareTo("aBc") -> 0
"aBc"~caselessCompareTo("abc") -> 0
"000abc000"~caselessCompareTo(111abc111", 4, 3) -> 0
]]>
</programlisting>
</section>
<section id="mthStringCaselessCountStr"><title>caselessCountStr</title>
<indexterm><primary>caselessCountStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessCountStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessCountStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessCountStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessCountStr(needle)--------------------------------------------><
]]>
</programlisting>
<para>Returns a count of the occurrences of
<emphasis role="italic">needle</emphasis> in the receiving
string that do not overlap. All matches are made using caseless comparisons.</para>
<para>Here are some examples:</para>
<indexterm><primary>examples</primary>
<secondary>countStr method</secondary></indexterm>
<programlisting>
<![CDATA[
"a0Aa0A"~caselessCountStr("a") -> 4
"J0kKk0"~caselessCountStr("KK") -> 1
]]>
</programlisting>
</section>
<section id="mthStringCaselessEquals"><title>caselessEquals</title>
<indexterm><primary>caselessEquals method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessEquals method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessEquals method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessEquals method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessEquals(other)-----------------------------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the target string is strictly equal to the
<emphasis role="italic">other</emphasis> string, using a caseless comparison.
Returns .false ("0") if the two strings are not strictly equal.
<emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessEquals method</secondary></indexterm>
<programlisting>
"a"~caselessEquals("A") -> 1
"aa"~caselessEquals("A") -> 0
"4"~caselessEquals("3") -> 0
</programlisting>
</section>
<section id="mthStringCaselessLastPos"><title>caselessLastPos</title>
<indexterm><primary>caselessLastPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessLastPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessLastPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessLastPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessLastPos(needle-+---------------------------+-)---><
+-,--+-------+--+---------+-+
+-start-+ +-,length-+
]]>
</programlisting>
<para>Returns the position of the last occurrence of a string,
<emphasis role="italic">needle</emphasis>,
in the receiving string. (See also <xref linkend="mthStringPos" />.) It
returns <computeroutput>0</computeroutput> if
<emphasis role="italic">needle</emphasis> is the null string or not found.
By default, the search starts at the last character of the receiving string
and scans backward to the beginning of the string. You can override this by
specifying
<emphasis role="italic">start</emphasis>, the point at which the
backward scan starts and <emphasis role="italic">length</emphasis>, the range of
characters to scan. The
<emphasis role="italic">start</emphasis> must be a positive whole number and
defaults to <computeroutput>receiving_string~length</computeroutput> if larger than that
value or omitted.
The <emphasis role="italic">length</emphasis> must be a non-negative whole
number and defaults to <emphasis role="italic">start</emphasis>. The search is
performed using caseless comparisons.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessLastPos method</secondary></indexterm>
<programlisting>
"abc def ghi"~caselessLastPos(" ") -> 8
"abcdefghi"~caselessLastPos(" ") -> 0
"efgxyz"~caselessLastPos("XY") -> 4
"abc def ghi"~caselessLastPos(" ",7) -> 4
"abc def ghi"~caselessLastPos(" ",7,3) -> 0
</programlisting>
</section>
<section id="mthStringCaselessMatch"><title>caselessMatch</title>
<indexterm><primary>caselessMatch method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessMatch method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessMatch method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessMatch method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessMatch(start,other-+----------------------------+-)-------------------><
+-,--+---+--+---------+------+
+-n-+ +-,length-+
]]>
</programlisting>
<para>Returns .true ("1") if the characters of the <emphasis role="italic">other</emphasis> match the
characters of the target string beginning at position <emphasis role="italic">start</emphasis>. Return .false
("0") if the characters are not a match. The matching is performed using caseless comparisons.
<emphasis role="italic">start</emphasis> must be a positive whole number less than or equal to the length of
the target string.
</para>
<para>If <emphasis role="italic">n</emphasis> is specified, the match will be performed starting with character
<emphasis role="italic">n</emphasis> of <emphasis role="italic">other</emphasis>. The default value for
<emphasis role="italic">n</emphasis> is "1". <emphasis role="italic">n</emphasis> must be a positive whole number
less than or equal to the length of <emphasis role="italic">other</emphasis>.
</para>
<para>If <emphasis role="italic">length</emphasis> is specified, it defines a substring of
<emphasis role="italic">other</emphasis> that is used for the match. <emphasis role="italic">length</emphasis>
must be a positive whole number and the combination of <emphasis role="italic">n</emphasis> and
<emphasis role="italic">length</emphasis> must be a valid substring within the bounds of
<emphasis role="italic">other</emphasis>.</para>
<para>The caselessMatch method is useful for efficient string parsing as it does
not require new string objects be extracted from the target string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessMatch method</secondary></indexterm>
<programlisting>
"Saturday"~caselessMatch(6, "day") -> 1
"Saturday"~caselessMatch(6, "DAY") -> 1
"Saturday"~caselessMatch(6, "SUNDAY", 4, 3) -> 1
"Saturday"~caselessMatch(6, "daytime", 1, 3) -> 1
</programlisting>
</section>
<section id="mthStringCaselessMatchChar"><title>caselessMatchChar</title>
<indexterm><primary>caselessMatchChar method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessMatchChar method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessMatchChar method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessMatchChar method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessMatchChar(n,chars)-------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the character at position <emphasis role="italic">n</emphasis> matches any
character of the string <emphasis role="italic">chars</emphasis>. Returns .false ("0") if the character does not
match any of the characters in the reference set. The match is made using caseless comparisons.
The argument <emphasis role="italic">n</emphasis> must be
a positive whole number less than or equal to the length of the target string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessMatchChar method</secondary></indexterm>
<programlisting>
"a+b"~caselessMatchChar(2, "+-*/") -> 1
"a+b"~caselessMatchChar(1, "+-*/") -> 0
"Friday"~caselessMatchChar(3, "aeiou") -> 1
"FRIDAY"~caselessMatchChar(3, "aeiou") -> 1
</programlisting>
</section>
<section id="mthStringCaselessPos"><title>caselessPos</title>
<indexterm><primary>caselessPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>caselessPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>caselessPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-caselessPos(needle-+---------------------------+-)---><
+-,--+-------+--+---------+-+
+-start-+ +-,length-+
]]>
</programlisting>
<para>Returns the position in the receiving string of another string,
<emphasis role="italic">needle</emphasis>. (See also
<xref linkend="mthStringLastPos" />.) It returns
<computeroutput>0</computeroutput> if
<emphasis role="italic">needle</emphasis> is the null string or is not found
or if <emphasis role="italic">start</emphasis> is greater than
the length of the receiving string. The search is performed using caseless
comparisons.
By default, the search starts at the first
character of the receiving string (that is, the value of
<emphasis role="italic">start</emphasis> is <computeroutput>1</computeroutput>),
and continues to the end of the string. You can override this by specifying
<emphasis role="italic">start
</emphasis>, the point at which the search starts, and
<emphasis role="italic">length</emphasis>, the bounding limit for the search.
If specified, <emphasis role="italic">start</emphasis> must be a positive
whole number and <emphasis role="italic">length</emphasis> must be
a non-negative whole number.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>caselessPos method</secondary></indexterm>
<programlisting>
"Saturday"~caselessPos("DAY") -> 6
"abc def ghi"~caselessPos("x") -> 0
"abc def ghi"~caselessPos(" ") -> 4
"abc def ghi"~caselessPos(" ",5) -> 8
"abc def ghi"~caselessPos(" ",5,3) -> 0
</programlisting>
</section>
<section id="mthStringCaselessWordPos"><title>caselessWordPos</title>
<indexterm><primary>caselessWordPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>wordPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>word</primary>
<secondary>locating in a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-caselessWordPos(phrase-+--------+-)---------------------------------><
+-,start-+
]]>
</programlisting>
<para>Returns the word number of the first word of
<emphasis role="italic">phrase</emphasis> found in the
receiving string, or <computeroutput>0</computeroutput> if
<emphasis role="italic">phrase</emphasis> contains no words or
if <emphasis role="italic">phrase</emphasis> is not found.
Word matches are made independent of case. Several whitespace characters between
words in either
<emphasis role="italic">phrase</emphasis> or the receiving string are treated as
a single blank for the comparison, but, otherwise, the words must match
exactly.</para>
<para>By default the search starts at the first word in the receiving
string.
You can override this by specifying <emphasis
role="italic">start</emphasis>
(which must be positive),
the word at which the search is to be started.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>wordPos method</secondary></indexterm>
<programlisting>
"now is the time"~caselessWordPos("the") -> 3
"now is the time"~caselessWordPos("The") -> 3
"now is the time"~caselessWordPos("IS THE") -> 2
"now is the time"~caselessWordPos("is the") -> 2
"now is the time"~caselessWordPos("is time ") -> 0
"To be or not to be"~caselessWordPos("BE") -> 2
"To be or not to be"~caselessWordPos("BE",3) -> 6
</programlisting>
</section>
<section id="mthStringCenter"><title>center/centre</title>
<indexterm><primary>center method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>center method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>centre method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>centre method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>text centering</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>centering using center function</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>centering using centre function</secondary></indexterm>
<programlisting>
<![CDATA[
>>-+-center(-+-length-+--------+-)-----------------------------><
+-centre(-+ +-,--pad-+
]]>
</programlisting>
<para>Returns a string of length <emphasis role="italic">length</emphasis>
with the receiving string centered in it. The
<emphasis role="italic">pad</emphasis> characters are added as necessary to
make up length. The <emphasis role="italic">length</emphasis> must be a
positive whole number or zero. The default
<emphasis role="italic">pad</emphasis> character is blank. If the receiving
string is longer than <emphasis role="italic">length</emphasis>, it is
truncated at both ends to fit. If an odd number
of characters are truncated or added, the right-hand end loses or gains one
more character than the left-hand end. </para>
<note><title>Note</title>
<para>To avoid errors because
of the difference between British and American spellings, this method can
be called either <emphasis role="bold">center</emphasis> or
<emphasis role="bold">centre</emphasis>.</para></note>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>center method</secondary></indexterm>
<indexterm><primary>examples</primary>
<secondary>centre method</secondary></indexterm>
<programlisting>
<![CDATA[
abc~center(7) -> " ABC "
abc~CENTER(8,"-") -> "--ABC---"
"The blue sky"~centre(8) -> "e blue s"
"The blue sky"~centre(7) -> "e blue "
]]>
</programlisting>
</section>
<section id="mthStringChangeStr"><title>changeStr</title>
<indexterm><primary>changeStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>changeStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-changeStr(needle,newneedle--+--------+--)---------------------------------><
+-,count-+
]]>
</programlisting>
<para>Returns a copy of the receiver object in which
<emphasis role="italic">newneedle</emphasis> replaces
occurrences of <emphasis role="italic">needle</emphasis>.</para>
<para>If <emphasis role="italic">count</emphasis> is not specified, all occurrences of
<emphasis role="italic">needle</emphasis> are replaced. If <emphasis role="italic">count</emphasis>
is specified, it must be a positive, whole number that gives the maximum number of
occurrences to be replaced.</para>
<para>Here are some examples:</para>
<indexterm><primary>examples</primary>
<secondary>changeStr method</secondary></indexterm>
<programlisting>
<![CDATA[
101100~changeStr("1","") -> "000"
101100~changeStr("1","X") -> "X0XX00"
101100~changeStr("1","X",1) -> "X01100"
]]>
</programlisting>
</section>
<section id="mthStringCompare"><title>compare</title>
<indexterm><primary>compare method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>compare method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>comparisons</primary>
<secondary>of strings</secondary></indexterm>
<indexterm><primary>finding</primary>
<secondary>mismatch using compare</secondary></indexterm>
<programlisting>
<![CDATA[
>>-compare(string-+------+-)-----------------------------------><
+-,pad-+
]]>
</programlisting>
<para>Returns <computeroutput>0</computeroutput> if the argument
<emphasis role="italic">string</emphasis> is identical to the
receiving string. Otherwise, returns the position of the first character that
does not match. The shorter string is padded on the right with
<emphasis role="italic">pad</emphasis> if
necessary. The default <emphasis role="italic">pad</emphasis> character is a
blank.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>compare method</secondary></indexterm>
<programlisting>
<![CDATA[
"abc"~compare("abc") -> 0
"abc"~compare("ak") -> 2
"ab "~compare("ab") -> 0
"ab "~compare("ab"," ") -> 0
"ab "~compare("ab","x") -> 3
"ab-- "~compare("ab","-") -> 5
]]>
</programlisting>
</section>
<section id="mthStringCompareTo"><title>compareTo</title>
<indexterm><primary>compareTo method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>compareTo method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>comparisons</primary>
<secondary>of strings</secondary></indexterm>
<indexterm><primary>finding</primary>
<secondary>mismatch using compareTo</secondary></indexterm>
<programlisting>
<![CDATA[
>>-compareTo(string-+-----------------------+-)----------------------><
+-,--+---+--+---------+-+
+-n-+ +-,length-+
]]>
</programlisting>
<para>Performs a sort comparison of the target string to the
<emphasis role="italic">string</emphasis> argument. If the
two strings are equal, <computeroutput>0</computeroutput> is returned. If
the target string is larger, <computeroutput>1</computeroutput> is returned.
<computeroutput>-1</computeroutput> if the <emphasis role="italic">string</emphasis>
argument is the larger string.
The comparison is performed starting at character <emphasis role="italic">n</emphasis>
for <emphasis role="italic">length</emphasis> characters in both strings.
<emphasis role="italic">n</emphasis> must be a positive whole number. If <emphasis role="italic">n</emphasis>
is omitted, the comparison starts at the first character.
<emphasis role="italic">length</emphasis> must be a non-negative whole number. If omitted, the comparison will take
place to the end of the target string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>compareTo method</secondary></indexterm>
<programlisting>
<![CDATA[
"abc"~compareTo("abc") -> 0
"b"~compareTo("a") -> 1
"a"~compareTo("b") -> -1
"abc"~compareTo("aBc") -> 1
"aBc"~compareTo("abc") -> -1
"000abc000"~compareTo(111abc111", 4, 3) -> 0
]]>
</programlisting>
</section>
<section id="mthStringCopies"><title>copies</title>
<indexterm><primary>copies method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>copies method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>copying a string using copies</primary></indexterm>
<indexterm><primary>repeating s string with copies</primary></indexterm>
<indexterm><primary>string</primary>
<secondary>copying using copies</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>repeating using copies</secondary></indexterm>
<programlisting>
<![CDATA[
>>-copies(n)---------------------------------------------------><
]]>
</programlisting>
<para>Returns <emphasis role="italic">n</emphasis> concatenated copies of the
receiving string. The <emphasis role="italic">n</emphasis> must be a positive
whole number or zero.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>copies method</secondary></indexterm>
<programlisting>
<![CDATA[
"abc"~copies(3) -> "abcabcabc"
"abc"~copies(0) -> ""
]]>
</programlisting>
</section>
<section id="mthStringCountStr"><title>countStr</title>
<indexterm><primary>countStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>countStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-countStr(needle)--------------------------------------------><
]]>
</programlisting>
<para>Returns a count of the occurrences of
<emphasis role="italic">needle</emphasis> in the receiving
string that do not overlap.</para>
<para>Here are some examples:</para>
<indexterm><primary>examples</primary>
<secondary>countStr method</secondary></indexterm>
<programlisting>
<![CDATA[
"101101"~countStr("1") -> 4
"J0KKK0"~CountStr("KK") -> 1
]]>
</programlisting>
</section>
<section id="mthStringD2c"><title>d2c</title>
<indexterm><primary>d2c method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>d2c method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>decimal to character</secondary></indexterm>
<indexterm><primary>decimal</primary>
<secondary>to character conversion</secondary></indexterm>
<programlisting>
<![CDATA[
>>-d2c-+-----+-------------------------------------------------><
+-(n)-+
]]>
</programlisting>
<para>Returns a string, in character format, that is the ASCII representation
of the receiving string, a decimal number. If you specify
<emphasis role="italic">n</emphasis>, it is
the length of the final result in characters; leading blanks are added to
the returned string. The <emphasis role="italic">n</emphasis> must be a
positive whole number or zero.</para>
<para>The receiving string must not have more digits than the current setting
of NUMERIC DIGITS.</para>
<para>If you omit <emphasis role="italic">n</emphasis>, the receiving string
must be a positive whole number
or zero, and the result length is as needed. Therefore, the returned result
has no leading "00"x characters.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>d2c method</secondary></indexterm>
<programlisting>
"65"~d2c -> "A" /* "41"x is an ASCII "A" */
"65"~d2c(1) -> "A"
"65"~d2c(2) -> " A"
"65"~d2c(5) -> " A"
"109"~d2c -> "m" /* "6D"x is an ASCII "m" */
"-109"~d2c(1) -> "&ocirc;" /* "93"x is an ASCII "&ocirc;" */
"76"~d2c(2) -> " L" /* "4C"x is an ASCII " L" */
"-180"~d2c(2) -> " L"
</programlisting>
<indexterm><primary>implementation maximum</primary>
<secondary>d2c method</secondary></indexterm>
<para>Implementation maximum: The returned string must not have more than 250
significant
characters, although a longer result is possible if it has additional leading
sign characters ("00"x and "FF"x).</para>
</section>
<section id="mthStringD2x"><title>d2x</title>
<indexterm><primary>d2x method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>d2x method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>decimal to hexadecimal</secondary></indexterm>
<indexterm><primary>decimal</primary>
<secondary>to hexadecimal conversion</secondary></indexterm>
<programlisting>
<![CDATA[
>>-d2x-+-----+-------------------------------------------------><
+-(n)-+
]]>
</programlisting>
<para>Returns a string, in character format, that represents the receiving
string, a decimal number converted to hexadecimal. The returned string uses
uppercase alphabetic characters for the values
<computeroutput>A</computeroutput>-<computeroutput>F</computeroutput> and does
not include whitespace.</para>
<para>The receiving string must not have more digits than the current setting
of NUMERIC DIGITS.</para>
<para>If you specify <emphasis role="italic">n</emphasis>, it is the length of
the final result in characters.
After conversion the returned string is sign-extended to the required length.
If the number is too big to fit into <emphasis role="italic">n</emphasis>
characters, it is truncated
on the left. If you specify <emphasis role="italic">n</emphasis>, it must be a
positive whole number or zero.</para>
<para>If you omit <emphasis role="italic">n</emphasis>, the receiving string
must be a positive whole number
or zero, and the returned result has no leading zeros.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>d2x method</secondary></indexterm>
<programlisting>
"9"~d2x -> "9"
"129"~d2x -> "81"
"129"~d2x(1) -> "1"
"129"~d2x(2) -> "81"
"129"~d2x(4) -> "0081"
"257"~d2x(2) -> "01"
"-127"~d2x(2) -> "81"
"-127"~d2x(4) -> "FF81"
"12"~d2x(0) -> ""
</programlisting>
<indexterm><primary>implementation maximum</primary>
<secondary>d2x method</secondary></indexterm>
<para>Implementation maximum: The returned string must not have more than 500
significant hexadecimal characters, although a longer result is possible if it
has additional leading sign characters (0 and F).</para>
</section>
<section id="mthStringDataType"><title>dataType</title>
<indexterm><primary>dataType method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>dataType method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>alphabetics</primary>
<secondary>checking with dataType</secondary></indexterm>
<indexterm><primary>alphnumerics</primary>
<secondary>checking with dataType</secondary></indexterm>
<indexterm><primary>bits checked using dataType method</primary></indexterm>
<indexterm><primary>hexadecimal</primary>
<secondary>checking with dataType</secondary></indexterm>
<indexterm><primary>type of data, checking with DataType</primary></indexterm>
<indexterm><primary>whole numbers</primary>
<secondary>checking with dataType</secondary></indexterm>
<indexterm><primary>numbers</primary>
<secondary>checking with dataType</secondary></indexterm>
<programlisting>
<![CDATA[
>>-dataType-+--------+-----------------------------------------><
+-(type)-+
]]>
</programlisting>
<para>Returns <computeroutput>NUM</computeroutput> if you specify no argument
and the receiving string
is a valid Rexx number that can be added to 0 without error. It returns
<computeroutput>CHAR</computeroutput> if the receiving string is not a
valid number.</para>
<para>If you specify <emphasis role="italic">type</emphasis>, it returns
<computeroutput>1</computeroutput> if the receiving
string matches the type. Otherwise, it returns
<computeroutput>0</computeroutput>. If the receiving
string is null, the method returns <computeroutput>0</computeroutput>
(except when the <emphasis role="italic">type</emphasis> is
<computeroutput>X</computeroutput> or <computeroutput>B</computeroutput>,
for which <emphasis role="bold">dataType</emphasis>
returns <computeroutput>1</computeroutput> for
a null string). The following are valid
<emphasis role="italic">type</emphasis>s. You need to specify
only the capitalized letter, or the number of the last type listed. The language
processor ignores all characters surrounding it.</para>
<variablelist>
<varlistentry><term>Alphanumeric</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only characters from the ranges
<computeroutput>a</computeroutput>-<computeroutput>z</computeroutput>,
<computeroutput>A</computeroutput>-<computeroutput>Z</computeroutput>, and
<computeroutput>0</computeroutput>-<computeroutput>9</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>Binary</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only the characters <computeroutput>0</computeroutput> or
<computeroutput>1</computeroutput>, or whitespace. Whitespace characters can
appear only between groups of 4 binary characters. It also returns 1 if string
is a null string, which is a valid binary string.
</para></listitem></varlistentry>
<varlistentry><term>Lowercase</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only characters from the range
<computeroutput>a</computeroutput>-<computeroutput>z</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>Mixed case</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only characters from the ranges
<computeroutput>a</computeroutput>-<computeroutput>z</computeroutput> and
<computeroutput>A</computeroutput>-<computeroutput>Z</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>Number</term>
<listitem><para>returns <computeroutput>1</computeroutput> if
<computeroutput>receiving_string~dataType</computeroutput> returns
<computeroutput>NUM</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>lOgical</term>
<listitem><para>returns <computeroutput>1</computeroutput> if
the receiving string is exactly "0" or "1". Otherwise it returns
<computeroutput>0</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>Symbol</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string is a valid symbol, that is, if SYMBOL(string) does not return
<computeroutput>BAD</computeroutput>. (See
<xref linkend="xsymbol" />.)
Note that both uppercase and lowercase alphabetic characters are permitted.
</para></listitem></varlistentry>
<varlistentry><term>Uppercase</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only characters from the range
<computeroutput>A</computeroutput>-<computeroutput>Z</computeroutput>.
</para></listitem></varlistentry>
<varlistentry><term>Variable</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string could appear on the left-hand
side of an assignment without causing a SYNTAX condition.
</para></listitem></varlistentry>
<varlistentry><term>Whole number</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string is a whole number under the current setting of NUMERIC DIGITS.
</para></listitem></varlistentry>
<varlistentry><term>heXadecimal</term>
<listitem><para>returns <computeroutput>1</computeroutput> if the receiving
string contains only characters from the ranges
<computeroutput>a</computeroutput>-<computeroutput>f</computeroutput>,
<computeroutput>A</computeroutput>-<computeroutput>F</computeroutput>,
<computeroutput>0</computeroutput>-<computeroutput>9</computeroutput>, and
whitespace characters (as long as whitespace characters appear only between
pairs of hexadecimal characters). Also returns
<computeroutput>1</computeroutput> if
the receiving string is a null string.
</para></listitem></varlistentry>
<varlistentry><term>9 Digits</term>
<listitem><para>returns <computeroutput>1</computeroutput> if
<computeroutput>receiving_string~dataType("W")</computeroutput> returns
<computeroutput>1</computeroutput> when NUMERIC DIGITS is set to 9.
</para></listitem></varlistentry>
</variablelist>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>dataType method</secondary></indexterm>
<programlisting>
<![CDATA[
" 12 "~dataType -> "NUM"
""~dataType -> "CHAR"
"123*"~dataType -> "CHAR"
"12.3"~dataType("N") -> 1
"12.3"~dataType("W") -> 0
"Fred"~dataType("M") -> 1
""~dataType("M") -> 0
"Fred"~dataType("L") -> 0
"?20K"~dataType("s") -> 1
"BCd3"~dataType("X") -> 1
"BC d3"~dataType("X") -> 1
"1"~dataType("O") -> 1
"11"~dataType("O") -> 0
]]>
</programlisting><para> </para>
<note><title>Note</title>
<para>The <emphasis role="bold">dataType</emphasis>
method tests the meaning or type of characters in a
string, independent of the encoding of those characters (for example, ASCII
or EBCDIC).</para></note>
</section>
<section id="mthStringDecodeBase64"><title>decodeBase64</title>
<indexterm><primary>decodeBase64 method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>decodeBase64 method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>base64</primary>
<secondary>decodeBase64 method</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>decodeBase64 method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-decodeBase64------------------------------------------------><
]]>
</programlisting>
<para>Returns a new string containing the decoded version of the base64 encoded
receiving string. If the receiving string is not in base64 format then the
returned result is undefined.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>decodeBase64 method</secondary></indexterm>
<programlisting>
<![CDATA[
"YWJjZGVm"~decodeBase64 -> "abcdef"
]]>
</programlisting>
</section>
<section id="mthStringDelStr"><title>delStr</title>
<indexterm><primary>delStr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>delStr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>deleting</primary>
<secondary>part of a string</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>deleting part, delStr method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-delStr(n--+---------+--)------------------------------------><
+-,length-+
]]>
</programlisting>
<para>Returns a copy of the receiving string after deleting the substring that
begins at the <emphasis role="italic">n</emphasis>th character and is of
<emphasis role="italic">length</emphasis> characters.
If you omit <emphasis role="italic">length</emphasis>, or if
<emphasis role="italic">length</emphasis> is greater than the number
of characters from <emphasis role="italic">n</emphasis> to the end of
<emphasis role="italic">string</emphasis>, the method deletes
the rest of <emphasis role="italic">string</emphasis> (including the
<emphasis role="italic">n</emphasis>th character). The
<emphasis role="italic">length</emphasis> must be a positive whole number or
zero. The <emphasis role="italic">n</emphasis> must be
a positive whole number. If <emphasis role="italic">n</emphasis> is greater
than the length of the receiving
string, the method returns the receiving string unchanged.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>delStr method</secondary></indexterm>
<programlisting>
<![CDATA[
"abcd"~delStr(3) -> "ab"
"abcde"~delStr(3,2) -> "abe"
"abcde"~delStr(6) -> "abcde"
]]>
</programlisting>
</section>
<section id="mthStringDelWord"><title>delWord</title>
<indexterm><primary>delWord method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>delWord method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>deleting</primary>
<secondary>words from a string</secondary></indexterm>
<indexterm><primary>word</primary>
<secondary>deleting from a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-delWord(n--+---------+--)-----------------------------------><
+-,length-+
]]>
</programlisting>
<para>Returns a copy of the receiving string after deleting the substring that
starts at the <emphasis role="italic">n</emphasis>th word and is of
<emphasis role="italic">length</emphasis> blank-delimited
words. If you omit <emphasis role="italic">length</emphasis>, or if
<emphasis role="italic">length</emphasis> is greater than
the number of words from <emphasis role="italic">n</emphasis> to the end of the
receiving string, the
method deletes the remaining words in the receiving string (including the
<emphasis role="italic">n</emphasis>th word). The
<emphasis role="italic">length</emphasis> must be a positive whole number or
zero. The <emphasis role="italic">n</emphasis> must be a positive whole number.
If <emphasis role="italic">n</emphasis> is greater than
the number of words in the receiving string, the method returns the receiving
string unchanged. The string deleted includes any whitespace characters
following the final word involved but none of the whitespace characters
preceding the first word involved.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>delWord method</secondary></indexterm>
<indexterm><primary>examples</primary>
<secondary>delWord method</secondary></indexterm>
<programlisting>
<![CDATA[
"Now is the time"~delWord(2,2) -> "Now time"
"Now is the time "~delWord(3) -> "Now is "
"Now is the time"~delWord(5) -> "Now is the time"
"Now is the time"~delWord(3,1) -> "Now is time"
]]>
</programlisting>
</section>
<section id="mthStringEncodeBase64"><title>encodeBase64</title>
<indexterm><primary>encodeBase64 method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>encodeBase64 method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>base64</primary>
<secondary>encodeBase64 method</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>encodeBase64 method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-encodeBase64------------------------------------------------><
]]>
</programlisting>
<para>Returns a new string that is the base64 encoded version of the receiving
string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>encodeBase64 method</secondary></indexterm>
<programlisting>
<![CDATA[
"abcdef"~encodeBase64 -> "YWJjZGVm"
]]>
</programlisting>
</section>
<section id="mthStringEquals"><title>equals</title>
<indexterm><primary>equals method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>equals method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-equals(other)-------------------------------------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the target string is strictly equal to the
<emphasis role="italic">other</emphasis> string.
Returns .false ("0") if the two strings are not strictly equal. This is
the same comparison performed by the "==" comparison method.
<emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>equals method</secondary></indexterm>
<programlisting>
"3"~equals("3") -> 1
"33"~equals("3") -> 0
"4"~equals("3") -> 0
</programlisting>
</section>
<section id="mthStringFormat"><title>format</title>
<indexterm><primary>format method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>format method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>formatting numbers</secondary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>numbers for display</secondary></indexterm>
<indexterm><primary>numbers</primary>
<secondary>formatting for display</secondary></indexterm>
<indexterm><primary>numbers for display</primary></indexterm>
<programlisting>
<![CDATA[
>>-format-+---------------------------------------------------------+-><
+-(-before-+------------------------------------------+-)-+
+-,--+-------+--+------------------------+-+
+-after-+ +-,--+------+--+-------+-+
+-expp-+ +-,expt-+
]]>
</programlisting>
<para>Returns a copy of the receiving string, a number, rounded and formatted.</para>
<para>The number is first rounded according to standard Rexx rules, as though
the operation <computeroutput>receiving_string+0</computeroutput> had been
carried out. If you
specify no arguments the result of the method is the same as the result of
this operation. If you specify any options, the number is formatted as
described in the following.</para>
<para>The <emphasis role="italic">before</emphasis> and
<emphasis role="italic">after</emphasis> options describe how many characters
are to be used for the integer and decimal parts of the result. If you omit
either or both of them, the number of characters for that part is as needed.
</para>
<para>If <emphasis role="italic">before</emphasis> is not large enough to
contain the integer part of the
number (plus the sign for a negative number), an error results. If
<emphasis role="italic">before</emphasis> is larger than needed for that part,
the number is padded on the left with blanks. If
<emphasis role="italic">after</emphasis> is not the same size as the decimal
part of the number, the number is rounded (or extended with zeros) to fit.
Specifying <computeroutput>0</computeroutput> causes the number to be rounded
to an integer.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>format method</secondary></indexterm>
<programlisting>
"3"~format(4) -> " 3"
"1.73"~format(4,0) -> " 2"
"1.73"~format(4,3) -> " 1.730"
"-.76"~format(4,1) -> " -0.8"
"3.03"~format(4) -> " 3.03"
" - 12.73"~format(,4) -> "-12.7300"
" - 12.73"~format -> "-12.73"
"0.000"~format -> "0"
</programlisting>
<para><emphasis role="italic">expp</emphasis> and
<emphasis role="italic">expt</emphasis> control the exponent part of the result,
which, by default, is formatted according to the current NUMERIC settings
of DIGITS and FORM. <emphasis role="italic">expp</emphasis> sets the number of
places for the exponent part; the default is to use as many as needed
(which can be zero). <emphasis role="italic">expt</emphasis>
specifies when the exponential expression is used. The default is the
current setting of NUMERIC DIGITS.</para>
<para>If <emphasis role="italic">expp</emphasis> is
<computeroutput>0</computeroutput>, the number is not an exponential expression.
If <emphasis role="italic">expp</emphasis> is not large enough to contain the
exponent, an error results.</para>
<para>If the number of places needed for the integer or decimal part exceeds
<emphasis role="italic">expt</emphasis> or twice
<emphasis role="italic">expt</emphasis>, respectively, exponential notation is
used. If <emphasis role="italic">expt</emphasis> is
<computeroutput>0</computeroutput>, exponential notation is always used unless
the exponent would be <computeroutput>0</computeroutput>. (If
<emphasis role="italic">expp</emphasis> is
<computeroutput>0</computeroutput>, this
overrides a <computeroutput>0</computeroutput> value of
<emphasis role="italic">expt</emphasis>.) If the exponent would be
<computeroutput>0</computeroutput> when a nonzero
<emphasis role="italic">expp</emphasis> is specified, then
<emphasis role="italic">expp</emphasis>+2 blanks
are supplied for the exponent part of the result. If the exponent would be
<computeroutput>0</computeroutput> and <emphasis role="italic">expp</emphasis>
is not specified, the number is not an exponential
expression.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<programlisting>
"12345.73"~format(, ,2,2) -> "1.234573E+04"
"12345.73"~format(,3, ,0) -> "1.235E+4"
"1.234573"~format(,3, ,0) -> "1.235"
"12345.73"~format(, ,3,6) -> "12345.73"
"1234567e5"~format(,3,0) -> "123456700000.000"
</programlisting>
</section>
<section id="mthStringHashCode"><title>hashCode</title>
<indexterm><primary>hashCode method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>hashCode method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-hashCode---------------------------------------------------><
]]>
</programlisting>
<para>Returns a string value that is used as a hash value for MapCollection
such as Table, Relation, Set, Bag, and Directory. The String hash code method will return
the same hash value for all pairs of string instances for which the == operator is true.
See <xref linkend="mthObjectHashCode" /> for details.
</para>
</section>
<section id="mthStringInsert"><title>insert</title>
<indexterm><primary>insert method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>insert method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>inserting a string into another</primary></indexterm>
<programlisting>
<![CDATA[
>>-insert(new-+---------------------------------------+-)------><
+-,--+---+--+-------------------------+-+
+-n-+ +-,--+--------+--+------+-+
+-length-+ +-,pad-+
]]>
</programlisting>
<para>Returns a copy of the receiver string with the string
<emphasis role="italic">new</emphasis>, padded or truncated
to length <emphasis role="italic">length</emphasis>, inserted after
the <emphasis role="italic">n</emphasis>th character.
The default value for <emphasis role="italic">n</emphasis> is
<computeroutput>0</computeroutput>, which means insertion at the beginning
of the string. If specified, <emphasis role="italic">n</emphasis> and
<emphasis role="italic">length</emphasis> must be positive
whole numbers or zero. If <emphasis role="italic">n</emphasis> is greater than
the length of the receiving string, the string
<emphasis role="italic">new</emphasis> is padded at the beginning. The default
value for <emphasis role="italic">length</emphasis> is the length of
<emphasis role="italic">new</emphasis>. If
<emphasis role="italic">length</emphasis> is less
than the length of the string <emphasis role="italic">new</emphasis>,
then <emphasis role="bold">insert</emphasis>
truncates <emphasis role="italic">new</emphasis> to length
<emphasis role="italic">length</emphasis>. The default
<emphasis role="italic">pad</emphasis> character is a blank.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>insert method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
"abc"~insert("123") -> "123abc"
"abcdef"~insert(" ",3) -> "abc def"
"abc"~insert("123",5,6) -> "abc 123 "
"abc"~insert("123",5,6,"+") -> "abc++123+++"
"abc"~insert("123", ,5,"-") -> "123--abc"
</programlisting>
</section>
<section id="mthStringLastPos"><title>lastPos</title>
<indexterm><primary>lastPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>lastPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>position</primary>
<secondary>last occurrence of a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-lastPos(needle-+---------------------------+-)---><
+-,--+-------+--+---------+-+
+-start-+ +-,length-+
]]>
</programlisting>
<para>Returns the position of the last occurrence of a string,
<emphasis role="italic">needle</emphasis>,
in the receiving string. (See also <xref linkend="mthStringPos" />.) It
returns <computeroutput>0</computeroutput> if
<emphasis role="italic">needle</emphasis> is the null string or not found.
By default, the search starts at the last character of the receiving string
and scans backward to the beginning of the string. You can override this by
specifying
<emphasis role="italic">start</emphasis>, the point at which the
backward scan starts and <emphasis role="italic">length</emphasis>, the range of
characters to scan. The
<emphasis role="italic">start</emphasis> must be a positive whole number and
defaults to <computeroutput>receiving_string~length</computeroutput> if larger than that
value or omitted.
The <emphasis role="italic">length</emphasis> must be a non-negative whole
number and defaults to <emphasis role="italic">start</emphasis>.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>lastPos method</secondary></indexterm>
<programlisting>
"abc def ghi"~lastPos(" ") -> 8
"abcdefghi"~lastPos(" ") -> 0
"efgxyz"~lastPos("xy") -> 4
"abc def ghi"~lastPos(" ",7) -> 4
"abc def ghi"~lastPos(" ",7,3) -> 0
</programlisting>
</section>
<section id="mthStringLeft"><title>left</title>
<indexterm><primary>left method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>left method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>text left justification</secondary></indexterm>
<programlisting>
<![CDATA[
>>-left(length-+------+-)--------------------------------------><
+-,pad-+
]]>
</programlisting>
<para>Returns a string of length <emphasis role="italic">length</emphasis>,
containing the leftmost <emphasis role="italic">length</emphasis> characters
of the receiving string. The string returned is padded
with <emphasis role="italic">pad</emphasis> characters (or truncated) on the
right as needed. The default <emphasis role="italic">pad</emphasis> character
is a blank. The <emphasis role="italic">length</emphasis> must be a positive
whole number or zero. The <emphasis role="bold">left</emphasis>
method is exactly equivalent to:</para>
<programlisting>
<![CDATA[
>>-SUBSTR(string,1,length-+------+-)---------------------------><
+-,pad-+
]]>
</programlisting>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>left method</secondary></indexterm>
<programlisting>
"abc d"~left(8) -> "abc d "
"abc d"~left(8,".") -> "abc d..."
"abc def"~left(7) -> "abc de"
</programlisting>
</section>
<section id="mthStringLength"><title>length</title>
<indexterm><primary>length method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>length method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>finding</primary>
<secondary>string length</secondary></indexterm>
<indexterm><primary>word</primary>
<secondary>finding length of</secondary></indexterm>
<programlisting>
<![CDATA[
>>-length------------------------------------------------------><
]]>
</programlisting>
<para>Returns the length of the receiving string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>length method</secondary></indexterm>
<programlisting>
"abcdefgh"~length -> 8
"abc defg"~length -> 8
""~length -> 0
</programlisting>
</section>
<section id="mthStringLower"><title>lower</title>
<indexterm><primary>lower method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>lower method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-lower(+---+--+---------+---)----------------------><
+-n-+ +-,length-+
]]>
</programlisting>
<para>Returns a new string with the characters of the target string beginning with
character <emphasis role="italic">n</emphasis> for <emphasis role="italic">length</emphasis>
characters converted to lowercase. If <emphasis role="italic">n</emphasis> is specified, it must
be a positive whole number. If <emphasis role="italic">n</emphasis> is not specified, the case
conversion will start with the first character. If <emphasis role="italic">length</emphasis>
is specified, it must be a non-negative whole number. If <emphasis role="italic">length</emphasis>
the default is to convert the remainder of the string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>lower method</secondary></indexterm>
<programlisting>
"Albert Einstein"~lower -> "albert einstein"
"ABCDEF"~lower(4) -> "ABCdef"
"ABCDEF"~lower(3,2) -> "ABcdEF"
</programlisting>
</section>
<section id="mthStringMakeArray"><title>makeArray</title>
<indexterm><primary>makeArray method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>makeArray method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-makeArray(-+-----------+-)----><
+-Separator-+
]]>
</programlisting>
<para>This method returns an array of strings containing the single
lines that were separated using the <emphasis role="bold">separator</emphasis> string.
The separator may be any string, including the null string. If the null string
is used, an array containing each character of the string is returned.
If the target string starts with the separator, the first array item will be a null
string. If the string ends with a separator, no extra null string item will be added.
The
default separator is the newline character.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
<![CDATA[
string = "hello".endofline"world".endofline"this is an array."
array = string~makeArray
say "the second line is:" array[2] /* world */
string = "hello*world*this is an array."
array = string~makeArray("*")
say "the third line is:" array[3] /* this is an array. */
string = "hello*world*this is an array.*"
array = string~makeArray("*") /* contains 3 items */
]]>
</programlisting>
</section>
<section id="mthStringMakeString"><title>makeString</title>
<indexterm><primary>makeString method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>makeString method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-makeString--------------------------------------------------><
]]>
</programlisting>
<para>Returns a string with the same string value as the receiver object. If
the receiver is an instance of a subclass of the String class, this method
returns an equivalent string object. If the receiver is a string object (not
an instance of a subclass of the String class), this method returns the receiver
object. See <xref linkend="reqstr" />.</para>
</section>
<section id="mthStringMatch"><title>match</title>
<indexterm><primary>match method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>match method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-match(start,other-+----------------------------+-)-------------------><
+-,--+---+--+---------+------+
+-n-+ +-,length-+
]]>
</programlisting>
<para>Returns .true ("1") if the characters of the <emphasis role="italic">other</emphasis> match the
characters of the target string beginning at position <emphasis role="italic">start</emphasis>. Return .false
("0") if the characters are not a match.
<emphasis role="italic">start</emphasis> must be a positive whole number less than or equal to the length of
the target string.
</para>
<para>If <emphasis role="italic">n</emphasis> is specified, the match will be performed starting with character
<emphasis role="italic">n</emphasis> of <emphasis role="italic">other</emphasis>. The default value for
<emphasis role="italic">n</emphasis> is "1". <emphasis role="italic">n</emphasis> must be a positive whole number
less than or equal to the length of <emphasis role="italic">other</emphasis>.
</para>
<para>If <emphasis role="italic">length</emphasis> is specified, it defines a substring of
<emphasis role="italic">other</emphasis> that is used for the match. <emphasis role="italic">length</emphasis>
must be a positive whole number and the combination of <emphasis role="italic">n</emphasis> and
<emphasis role="italic">length</emphasis> must be a valid substring within the bounds of
<emphasis role="italic">other</emphasis>.</para>
<para>The match method is useful for efficient string parsing as it does not
require new string objects be extracted from the target string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>match method</secondary></indexterm>
<programlisting>
"Saturday"~match(6, "day") -> 1
"Saturday"~match(6, "DAY") -> 0
"Saturday"~match(6, "Sunday", 4, 3) -> 1
"Saturday"~match(6, "daytime", 1, 3) -> 1
</programlisting>
</section>
<section id="mthStringMatchChar"><title>matchChar</title>
<indexterm><primary>matchChar method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>matchChar method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-matchChar(n,chars)-------------------------><
]]>
</programlisting>
<para>Returns .true ("1") if the character at position <emphasis role="italic">n</emphasis> matches any
character of the string <emphasis role="italic">chars</emphasis>. Returns .false ("0") if the character does not
match any of the characters in the reference set. The argument <emphasis role="italic">n</emphasis> must be
a positive whole number less than or equal to the length of the target string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>matchChar method</secondary></indexterm>
<programlisting>
"a+b"~matchChar(2, "+-*/") -> 1
"a+b"~matchChar(1, "+-*/") -> 0
"Friday"~matchChar(3, "aeiou") -> 1
"FRIDAY"~matchChar(3, "aeiou") -> 0
</programlisting>
</section>
<section id="mthStringMax"><title>max</title>
<indexterm><primary>max method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>max method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-max-+------------------+------------------------------------><
| +-,------+ |
| V | |
+-(----number-+--)-+
]]>
</programlisting>
<para>Returns the largest number from among the receiver and any arguments. The
number that <emphasis role="bold">max</emphasis>
returns is formatted according to the current NUMERIC settings.
You can specify any number of <emphasis role="italic">number</emphasis>s.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>max method</secondary></indexterm>
<programlisting>
12~max(6,7,9) -> 12
17.3~max(19,17.03) -> 19
"-7"~max("-3","-4.3") -> -3
1~max(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21) -> 21
</programlisting>
</section>
<section id="mthStringMin"><title>min</title>
<indexterm><primary>min method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>min method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-min-+------------------+------------------------------------><
| +-,------+ |
| V | |
+-(----number-+--)-+
]]>
</programlisting>
<para>Returns the smallest number from among the receiver and any arguments.
The number that <emphasis role="bold">min</emphasis>
returns is formatted according to the current NUMERIC
settings. You can specify any number of
<emphasis role="italic">number</emphasis>s.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>min method</secondary></indexterm>
<programlisting>
12~min(6,7,9) -> 6
17.3~min(19,17.03) -> 17.03
"-7"~MIN("-3","-4.3") -> -7
21~min(20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1) -> 1
</programlisting>
</section>
<section id="mthStringOverlay"><title>overlay</title>
<indexterm><primary>overlay method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>overlay method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>overlaying a string onto another</primary></indexterm>
<programlisting>
<![CDATA[
>>-overlay(new-+---------------------------------------+-)-----><
+-,--+---+--+-------------------------+-+
+-n-+ +-,--+--------+--+------+-+
+-length-+ +-,pad-+
]]>
</programlisting>
<para>Returns a copy of the receiving string, which, starting at the
<emphasis role="italic">n</emphasis>th character,
is overlaid with the string <emphasis role="italic">new</emphasis>,
padded or truncated to length <emphasis role="italic">length</emphasis>.
The overlay can extend beyond the end of the receiving string.
If you specify <emphasis role="italic">length</emphasis>, it must be a positive
whole number or zero. The default value for
<emphasis role="italic">length</emphasis> is the length of
<emphasis role="italic">new</emphasis>. If <emphasis role="italic">n</emphasis>
is greater than the length of the receiving string, padding is added
before the <emphasis role="italic">new</emphasis> string. The default
<emphasis role="italic">pad</emphasis> character is a blank,
and the default value for <emphasis role="italic">n</emphasis> is
<computeroutput>1</computeroutput>. If you specify
<emphasis role="italic">n</emphasis>, it must be a positive whole number.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>overlay method</secondary></indexterm>
<programlisting>
"abcdef"~overlay(" ",3) -> "ab def"
"abcdef"~overlay(".",3,2) -> "ab. ef"
"abcd"~overlay("qq") -> "qqcd"
"abcd"~overlay("qq",4) -> "abcqq"
"abc"~overlay("123",5,6,"+") -> "abc+123+++"
</programlisting>
</section>
<section id="mthStringPos"><title>pos</title>
<indexterm><primary>pos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>pos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>finding</primary>
<secondary>string in another string</secondary></indexterm>
<indexterm><primary>locating</primary>
<secondary>string in another string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-pos(needle-+---------------------------+-)---><
+-,--+-------+--+---------+-+
+-start-+ +-,length-+
]]>
</programlisting>
<para>Returns the position in the receiving string of another string,
<emphasis role="italic">needle</emphasis>. (See also
<xref linkend="mthStringLastPos" />.) It returns
<computeroutput>0</computeroutput> if
<emphasis role="italic">needle</emphasis> is the null string or is not found
or if <emphasis role="italic">start</emphasis> is greater than
the length of the receiving string.
By default, the search starts at the first
character of the receiving string (that is, the value of
<emphasis role="italic">start</emphasis> is <computeroutput>1</computeroutput>),
and continues to the end of the string. You can override this by specifying
<emphasis role="italic">start
</emphasis>, the point at which the search starts, and
<emphasis role="italic">length</emphasis>, the bounding limit for the search.
If specified, <emphasis role="italic">start</emphasis> must be a positive
whole number and <emphasis role="italic">length</emphasis> must be
a non-negative whole number.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>pos method</secondary></indexterm>
<programlisting>
"Saturday"~pos("day") -> 6
"abc def ghi"~pos("x") -> 0
"abc def ghi"~pos(" ") -> 4
"abc def ghi"~pos(" ",5) -> 8
"abc def ghi"~pos(" ",5,3) -> 0
</programlisting>
</section>
<section id="mthStringReplaceAt"><title>replaceAt</title>
<indexterm><primary>replaceAt method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>replaceAt method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>replacing characters within a string</primary></indexterm>
<programlisting>
<![CDATA[
>>-replaceAt(new-,-n-,-+----------+-+-------+-)-----><
+-,-length-+ +-,-pad-+
]]>
</programlisting>
<para>Returns a copy of the receiving string, with the
characters from the
<emphasis role="italic">n</emphasis>th character for <emphasis role="italic">length</emphasis>
characters replaced with
<emphasis role="italic">new</emphasis>. The replacement position and length can
extend beyond the end of the receiving string.
The starting
position,
<emphasis role="italic">n</emphasis>, is required and must be a positive whole number. The <emphasis
role="italic">length</emphasis> argument is opitonal must be a positive whole number or zero. If omitted, <emphasis
role="italic">length</emphasis> defaults to the length of <emphasis role="italic">new</emphasis>.
</para>
<para>
If <emphasis
role="italic">n</emphasis> is greater than the length of the receiving string, padding is added before the <emphasis
role="italic">new</emphasis> string. The default <emphasis role="italic">pad</emphasis> character is a blank.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>replaceAt method</secondary></indexterm>
<programlisting>
"abcdef"~replaceAt(" ",3, 1) -> "ab def"
"abcdef"~replaceAt(" ",3, 3) -> "ab f"
"abc"~replaceAt("123",5,6,"+") -> "abc+123"
</programlisting> </section>
<section id="mthStringReverse"><title>reverse</title>
<indexterm><primary>reverse method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>reverse method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-reverse-----------------------------------------------------><
]]>
</programlisting>
<para>Returns a copy of the receiving string reversed.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>reverse method</secondary></indexterm>
<programlisting>
"ABc."~reverse -> ".cBA"
"XYZ "~reverse -> " ZYX"
</programlisting>
</section>
<section id="mthStringRight"><title>right</title>
<indexterm><primary>right method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>right method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>text right justification</secondary></indexterm>
<indexterm><primary>justification, text right, RIGHT method</primary>
</indexterm>
<indexterm><primary>leading</primary>
<secondary>zeros</secondary>
<tertiary>adding with right method</tertiary></indexterm>
<indexterm><primary>zeros</primary>
<secondary>added on left with right method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-right(length-+------+-)-------------------------------------><
+-,pad-+
]]>
</programlisting>
<para>Returns a string of length <emphasis role="italic">length</emphasis>
containing the rightmost <emphasis role="italic">length</emphasis> characters
of the receiving string. The string returned is padded
with <emphasis role="italic">pad</emphasis> characters, or truncated, on the
left as needed. The default <emphasis role="italic">pad</emphasis> character
is a blank. The <emphasis role="italic">length</emphasis> must be a positive
whole number or zero.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>right method</secondary></indexterm>
<programlisting>
"abc d"~right(8) -> " abc d"
"abc def"~right(5) -> "c def"
"12"~right(5,"0") -> "00012"
</programlisting>
</section>
<section id="mthStringSign"><title>sign</title>
<indexterm><primary>sign method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>sign method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-sign--------------------------------------------------------><
]]>
</programlisting>
<para>Returns a number that indicates the sign of the receiving string, which
is a number. The receiving string is first rounded according to standard Rexx
rules, as though the operation
<computeroutput>receiving_string+0</computeroutput> had been carried
out. It returns <computeroutput>-1</computeroutput> if the receiving string is
less than <computeroutput>0</computeroutput>,
<computeroutput>0</computeroutput> if it is
<computeroutput>0</computeroutput>, and <computeroutput>1</computeroutput>
if it is greater than <computeroutput>0</computeroutput>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>sign method</secondary></indexterm>
<programlisting>
"12.3"~sign -> 1
" -0.307"~sign -> -1
0.0~sign -> 0
</programlisting>
</section>
<section id="mthStringSpace"><title>space</title>
<indexterm><primary>space method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>space method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>text spacing</secondary></indexterm>
<indexterm><primary>spacing, formatting, space method</primary></indexterm>
<programlisting>
<![CDATA[
>>-space-+---------------+-------------------------------------><
+-(n-+------+-)-+
+-,pad-+
]]>
</programlisting>
<para>Returns a copy of receiving string, with
<emphasis role="italic">n</emphasis>&nbsp;<emphasis role="italic">pad</emphasis>
characters between each whitespace-delimited word. If you specify
<emphasis role="italic">n</emphasis>, it must
be a positive whole number or zero. If it is
<computeroutput>0</computeroutput>, all whitespace characters are removed.
Leading and trailing whitespace characters are always removed. The default for
<emphasis role="italic">n</emphasis> is <computeroutput>1</computeroutput>,
and the default <emphasis role="italic">pad</emphasis> character is a blank.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>space method</secondary></indexterm>
<programlisting>
"abc def "~space -> "abc def"
" abc def"~space(3) -> "abc def"
"abc def "~space(1) -> "abc def"
"abc def "~space(0) -> "abcdef"
"abc def "~space(2,"+") -> "abc++def"
</programlisting>
</section>
<section id="mthStringStrip"><title>strip</title>
<indexterm><primary>strip method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>strip method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>blanks</primary>
<secondary>removal with strip method</secondary></indexterm>
<indexterm><primary>whitespace</primary>
<secondary>removal with strip method</secondary></indexterm>
<indexterm><primary>character</primary>
<secondary>removal with strip method</secondary></indexterm>
<indexterm><primary>leading</primary>
<secondary>zeros</secondary>
<tertiary>removing with strip method</tertiary></indexterm>
<indexterm><primary>leading</primary>
<secondary>whitespace removal with strip method</secondary></indexterm>
<indexterm><primary>trailing</primary>
<secondary>whitespace removed using strip method</secondary></indexterm>
<indexterm><primary>zeros</primary>
<secondary>removal with strip method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-strip-+---------------------+-------------------------------><
+-(option-+-------+-)-+
+-,char-+
]]>
</programlisting>
<para>Returns a copy of the receiving string with leading characters, trailing characters,
or both, removed, based on the <emphasis role="italic">option</emphasis> you
specify. The following are valid <emphasis role="italic">option</emphasis>s.
(You need to specify only the first capitalized
letter; all characters following it are ignored.) </para>
<variablelist>
<varlistentry><term>Both</term>
<listitem><para>Removes both leading and trailing characters. This is the
default.
</para></listitem></varlistentry>
<varlistentry><term>Leading</term>
<listitem><para>Removes leading characters.
</para></listitem></varlistentry>
<varlistentry><term>Trailing</term>
<listitem><para>Removes trailing characters.
</para></listitem></varlistentry>
</variablelist>
<para>The <emphasis role="italic">char</emphasis> specifies the character to be
removed, and the default is a blank. If you specify
<emphasis role="italic">char</emphasis>, it must be exactly one character
long.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>strip method</secondary></indexterm>
<programlisting>
" ab c "~strip -> "ab c"
" ab c "~strip("L") -> "ab c "
" ab c "~strip("t") -> " ab c"
"12.7000"~strip(,0) -> "12.7"
"0012.700"~strip(,0) -> "12.7"
</programlisting>
</section>
<section id="mthStringsubchar"><title>subchar</title>
<indexterm><primary>subchar method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>subchar method</secondary>
<tertiary>of String</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-subchar(n)----------------------------------------------><
]]>
</programlisting>
<para>Returns the <emphasis>n</emphasis>'th character of the receiving
string. <emphasis>n</emphasis> must be a positive whole number. If
<emphasis>n</emphasis> is greater that the length of the receiving string
then a zero-length string is returned.</para>
</section>
<section id="mthStringSubstr"><title>substr</title>
<indexterm><primary>substr method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>substr method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>extracting</primary>
<secondary>substring</secondary></indexterm>
<indexterm><primary>string</primary>
<secondary>extracting using substr method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-substr(n-+-------------------------+-)----------------------><
+-,--+--------+--+------+-+
+-length-+ +-,pad-+
]]>
</programlisting>
<para>Returns the substring of the receiving string that begins at the
<emphasis role="italic">n</emphasis>th character and is of length
<emphasis role="italic">length</emphasis>, padded with
<emphasis role="italic">pad</emphasis> if
necessary. The <emphasis role="italic">n</emphasis> must be a positive whole
number. If <emphasis role="italic">n</emphasis> is
greater than <computeroutput>receiving_string~length</computeroutput>,
only pad characters are returned.</para>
<para>If you omit <emphasis role="italic">length</emphasis>, the rest of the
string is returned. The default <emphasis role="italic">pad</emphasis>
character is a blank.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>subStr method</secondary></indexterm>
<programlisting>
"abc"~substr(2) -> "bc"
"abc"~substr(2,4) -> "bc "
"abc"~substr(2,6,".") -> "bc...."
</programlisting>
<note><title>Note</title>
<para>In some situations the positional (numeric) patterns
of parsing templates are more convenient for selecting substrings, in particular
if you need to extract more than one substring from a string. See also
<xref linkend="mthStringLeft" /> and <xref linkend="mthStringRight" />.
</para></note>
</section>
<section id="mthStringSubWord"><title>subWord</title>
<indexterm><primary>subWord method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>subWord method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>extracting words with subWord</primary></indexterm>
<indexterm><primary>word</primary>
<secondary>extracting from a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-subWord(n-+---------+-)-------------------------------------><
+-,length-+
]]>
</programlisting>
<para>Returns the substring of the receiving string that starts at the
<emphasis role="italic">n</emphasis>th word and is up to
<emphasis role="italic">length</emphasis> blank-delimited words. The
<emphasis role="italic">n</emphasis> must be a positive whole number.
If you omit <emphasis role="italic">length</emphasis>, it defaults
to the number of remaining words in the receiving string. The returned string
never has leading or trailing whitespace, but includes all whitespace characters
between the selected words.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>subWord method</secondary></indexterm>
<programlisting>
"Now is the time"~subWord(2,2) -> "is the"
"Now is the time"~subWord(3) -> "the time"
"Now is the time"~subWord(5) -> ""
</programlisting>
</section>
<section id="mthStringSubWords"><title>subWords</title>
<indexterm><primary>subWords method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>subWords method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>extracting words with subWords</primary></indexterm>
<indexterm><primary>word</primary>
<secondary>extracting from a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-subWords(--+---+-+---------+-)-------------------------------------><
+-n-+ +-,length-+
]]>
</programlisting>
<para>Returns an array containing all words within the substring
of the receiving string that starts at the
<emphasis role="italic">n</emphasis>th word and is up to
<emphasis role="italic">length</emphasis> blank-delimited words. The
<emphasis role="italic">n</emphasis> must be a positive whole number. If you omit
<emphasis role="italic">n</emphasis>, it defaults to 1.
If you omit <emphasis role="italic">length</emphasis>, it defaults
to the number of remaining words in the receiving string. The strings
in the returned array never have leading or trailing whitespace.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>subWords method</secondary></indexterm>
<programlisting>
"Now is the time"~subWords -> .array~of("Now", "is", "the", "time")
"Now is the time"~subWords(2,2) -> .array~of("is", "the")
"Now is the time"~subWords(3) -> .array~of("the", "time")
"Now is the time"~subWords(5) -> .array~new(0)
</programlisting>
<para>The subWords method is useful for iterating over the individual words in a string.</para>
<programlisting>
do word over source~subWords -- extract all of the words to loop over
say word
end
</programlisting>
</section>
<section id="mthStringTranslate"><title>translate</title>
<indexterm><primary>translate method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>translate method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>reordering data</primary></indexterm>
<indexterm><primary>translation</primary>
<secondary>with translate method</secondary></indexterm>
<indexterm><primary>uppercase translation</primary>
<secondary>with translate method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-translate-+--------------------------------------------------------------------------+-><
+-(--+-------------------------------------+-+-----------------------+-)---+
+-tableo--+-------------------------+-+ +-,--+---+--+---------+-+
+-,--+--------+--+------+-+ +-n-+ +-,length-+
+-tablei-+ +-,pad-+
]]>
</programlisting>
<para>Returns a copy of the receiving string with each character translated to
another character or unchanged. You can also use this method to reorder the
characters in the output table. (See last example)</para>
<para>The output table is <emphasis role="italic">tableo</emphasis>
and the input translation table is <emphasis role="italic">tablei</emphasis>.
<emphasis role="bold">translate</emphasis> searches
<emphasis role="italic">tablei</emphasis> for each character
in the receiving string. If the character is found, the corresponding character
in <emphasis role="italic">tableo</emphasis> is used in the result string. If
there are duplicates in <emphasis role="italic">tablei</emphasis>, the first
(leftmost) occurrence is used. If the character is
not found, the original character in the receiving string is used. The result
string is always of the same length as the receiving string.</para>
<para>The tables can be of any length. If you specify neither translation table and
omit <emphasis role="italic">pad</emphasis>, the receiving string is
translated to uppercase (that is, lowercase
<computeroutput>a</computeroutput>-<computeroutput>z</computeroutput>
to uppercase
<computeroutput>A</computeroutput>-<computeroutput>Z</computeroutput>),
but if you include <emphasis role="italic">pad</emphasis>
the entire
string is translated to <emphasis role="italic">pad</emphasis> characters.
<emphasis role="italic">tablei</emphasis> defaults to
<computeroutput>XRANGE("00"x,"FF"x)</computeroutput>, and
<emphasis role="italic">tableo</emphasis> defaults to the null string and
is padded with <emphasis role="italic">pad</emphasis> or truncated as necessary.
The default <emphasis role="italic">pad</emphasis> is a blank.</para>
<para><emphasis role="italic">n</emphasis> is the position of the first
character of the translated range. The default starting position is 1.
<emphasis role="italic">length</emphasis> is the range of characters to be
translated. If omitted, <emphasis role="italic">length</emphasis> remainder of
the string from the starting position to the end is used. </para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>translate method</secondary></indexterm>
<programlisting>
"abcdef"~translate -> "ABCDEF"
"abcdef"~translate(, , , 3, 2) -> "abCDef"
"abcdef"~translate("12", "ec") -> "ab2d1f"
"abcdef"~translate("12", "abcd", ".") -> "12..ef"
"APQRV"~translate(, "PR") -> "A Q V"
"APQRV"~translate(XRANGE("00"X, "Q")) -> "APQ "
"4123"~translate("abcd", "1234") -> "dabc"
"4123"~translate("abcd", "1234", , 2, 2) -> "4ab1"
</programlisting>
<note><title>Note</title>
<para>The last example shows how to use the
<emphasis role="bold">translate</emphasis> method
to reorder the characters in a string. In the example, the last character
of any 4-character string specified as the first argument would be moved to
the beginning of the string.</para></note>
</section>
<section id="mthStringTrunc"><title>trunc</title>
<indexterm><primary>trunc method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>trunc method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>formatting</primary>
<secondary>numbers with trunc</secondary></indexterm>
<indexterm><primary>truncating numbers</primary></indexterm>
<indexterm><primary>numbers</primary>
<secondary>truncating</secondary></indexterm>
<programlisting>
<![CDATA[
>>-trunc-+-----+-----------------------------------------------><
+-(n)-+
]]>
</programlisting>
<para>Returns the integer part the receiving string, which is a number, and
<emphasis role="italic">n</emphasis> decimal places. The default
<emphasis role="italic">n</emphasis> is <computeroutput>0</computeroutput>
and returns an integer with no decimal point. If you specify
<emphasis role="italic">n</emphasis>, it must be a
positive whole number or zero. The receiving string is first rounded according
to standard Rexx rules, as though the operation
<computeroutput>receiving_string+0</computeroutput> had been carried out.
This number is then truncated to <emphasis role="italic">n</emphasis> decimal
places or trailing zeros are added if needed to reach the specified length.
The result is never in exponential form. If there are no nonzero digits in
the result, any minus sign is removed.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>trunc method</secondary></indexterm>
<programlisting>
12.3~trunc -> 12
127.09782~trunc(3) -> 127.097
127.1~trunc(3) -> 127.100
127~trunc(2) -> 127.00
</programlisting>
<note><title>Note</title>
<para>The <emphasis role="italic">number</emphasis> is rounded according to the
current setting of NUMERIC DIGITS if necessary, before the method processes it.
</para></note>
</section>
<section id="mthStringUpper"><title>upper</title>
<indexterm><primary>upper method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>upper method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-upper(+---+--+---------+---)----------------------><
+-n-+ +-,length-+
]]>
</programlisting>
<para>Returns a new string with the characters of the target string beginning with
character <emphasis role="italic">n</emphasis> for <emphasis role="italic">length</emphasis>
characters converted to uppercase. If <emphasis role="italic">n</emphasis> is specified, it must
be a positive whole number. If <emphasis role="italic">n</emphasis> is not specified, the case
conversion will start with the first character. If <emphasis role="italic">length</emphasis>
is specified, it must be a non-negative whole number. If <emphasis role="italic">length</emphasis>
the default is to convert the remainder of the string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>upper method</secondary></indexterm>
<programlisting>
"Albert Einstein"~upper -> "ALBERT EINSTEIN"
"abcdef"~upper(4) -> "abcDEF"
"abcdef"~upper(3,2) -> "abCDef"
</programlisting>
</section>
<section id="mthStringVerify"><title>verify</title>
<indexterm><primary>verify method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>verify method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>string</primary>
<secondary>verifying contents of</secondary></indexterm>
<indexterm><primary>verifying contents of a string</primary></indexterm>
<programlisting>
<![CDATA[
>>-verify(reference-+----------------------------------------------+-)--><
+-,--+--------+--+---------------------------+-+
+-option-+ +-,--+-------+--+---------+-+
+-start-+ +-,length-+
]]>
</programlisting>
<para>Returns a number that, by default, indicates whether the receiving string
is composed only of characters from
<emphasis role="italic">reference</emphasis>. It returns
<computeroutput>0</computeroutput> if all characters in the receiving string
are in <emphasis role="italic">reference</emphasis> or
returns the position of the first character in the receiving string not in
<emphasis role="italic">reference</emphasis>.</para>
<para>The <emphasis role="italic">option</emphasis> can be either
<computeroutput>Nomatch</computeroutput> (the
default) or <computeroutput>Match</computeroutput>. (You need to specify only
the first capitalized and highlighted letter;
all characters following the first character are ignored)</para>
<para>If you specify <computeroutput>Match</computeroutput>, the method returns
the position of the first character in the receiving string that is in
<emphasis role="italic">reference</emphasis>, or returns
<computeroutput>0</computeroutput> if none of the characters
are found.</para>
<para>The default for <emphasis role="italic">start</emphasis> is
<computeroutput>1</computeroutput>. Thus, the search starts
at the first character of the receiving string. You can override this by
specifying a different <emphasis role="italic">start</emphasis> point,
which must be a positive whole number.</para>
<para>The default for <emphasis role="italic">length</emphasis> is the length of
the string from <emphasis role="italic">start</emphasis> to the end of the
string. Thus, the search proceeds to the end of the receiving string. You can
override this by specifying a different
<emphasis role="italic">length</emphasis>, which must be a non-negative whole
number.
</para>
<para>If the receiving string is null, the method returns
<computeroutput>0</computeroutput>, regardless
of the value of the <emphasis role="italic">option</emphasis>. Similarly, if
<emphasis role="italic">start</emphasis> is greater
than <computeroutput>receiving_string~length</computeroutput>, the method
returns <computeroutput>0</computeroutput>. If
<emphasis role="italic">reference</emphasis> is null, the method returns
<computeroutput>0</computeroutput> if
you specify <computeroutput>Match</computeroutput>. Otherwise, the method
returns the <emphasis role="italic">start</emphasis> value.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>verify method</secondary></indexterm>
<programlisting>
"123"~verify("1234567890") -> 0
"1Z3"~verify("1234567890") -> 2
"AB4T"~verify("1234567890") -> 1
"AB4T"~verify("1234567890","M") -> 3
"AB4T"~verify("1234567890","N") -> 1
"1P3Q4"~verify("1234567890", ,3) -> 4
"123"~verify("",N,2) -> 2
"ABCDE"~verify("", ,3) -> 3
"AB3CD5"~verify("1234567890","M",4) -> 6
"ABCDEF"~verify("ABC","N",2,3) -> 4
"ABCDEF"~verify("ADEF","M",2,3) -> 4
</programlisting>
</section>
<section id="mthStringWord"><title>word</title>
<indexterm><primary>word method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>word method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>extracting</primary>
<secondary>word from a string</secondary></indexterm>
<indexterm><primary>locating</primary>
<secondary>word in another string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-word(n)-----------------------------------------------------><
]]>
</programlisting>
<para>Returns the <emphasis role="italic">n</emphasis>th whitespace-delimited
word in the receiving string or the null string if the receiving string has
fewer than
<emphasis role="italic">n</emphasis> words. The
<emphasis role="italic">n</emphasis> must be a positive whole number. This
method is exactly equivalent
to <computeroutput>receiving_string~subWord(n,1)</computeroutput>.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>word method</secondary></indexterm>
<programlisting>
"Now is the time"~word(3) -> "the"
"Now is the time"~word(5) -> ""
</programlisting>
</section>
<section id="mthStringWordIndex"><title>wordIndex</title>
<indexterm><primary>wordIndex method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>wordIndex method</secondary>
<tertiary>of String class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-wordIndex(n)------------------------------------------------><
]]>
</programlisting>
<para>Returns the position of the first character in the
<emphasis role="italic">n</emphasis>th whitespace-delimited word in the
receiving string. It returns
<computeroutput>0</computeroutput> if the receiving string has fewer than
<emphasis role="italic">n</emphasis> words. The <emphasis
role="italic">n</emphasis> must be a positive whole number.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>wordIndex method</secondary></indexterm>
<programlisting>
"Now is the time"~wordIndex(3) -> 8
"Now is the time"~wordIndex(6) -> 0
</programlisting>
</section>
<section id="mthStringWordLength"><title>wordLength</title>
<indexterm><primary>wordLength method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>wordLength method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>finding</primary>
<secondary>word length</secondary></indexterm>
<programlisting>
<![CDATA[
>>-wordLength(n)-----------------------------------------------><
]]>
</programlisting>
<para>Returns the length of the <emphasis role="italic">n</emphasis>th
whitespace-delimited word in the receiving
string or <computeroutput>0</computeroutput> if the receiving string has fewer
than <emphasis role="italic">n</emphasis> words.
The <emphasis role="italic">n</emphasis> must be a positive whole number.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>wordLength method</secondary></indexterm>
<programlisting>
"Now is the time"~wordLength(2) -> 2
"Now comes the time"~wordLength(2) -> 5
"Now is the time"~wordLength(6) -> 0
</programlisting>
</section>
<section id="mthStringWordPos"><title>wordPos</title>
<indexterm><primary>wordPos method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>wordPos method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>word</primary>
<secondary>locating in a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-wordPos(phrase-+--------+-)---------------------------------><
+-,start-+
]]>
</programlisting>
<para>Returns the word number of the first word of
<emphasis role="italic">phrase</emphasis> found in the
receiving string, or <computeroutput>0</computeroutput> if
<emphasis role="italic">phrase</emphasis> contains no words or
if <emphasis role="italic">phrase</emphasis> is not found. Several whitespace
characters between words in either
<emphasis role="italic">phrase</emphasis> or the receiving string are treated as
a single blank for the comparison, but, otherwise, the words must match
exactly.</para>
<para>By default the search starts at the first word in the receiving string.
You can override this by specifying <emphasis role="italic">start</emphasis>
(which must be positive),
the word at which the search is to be started.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>wordPos method</secondary></indexterm>
<programlisting>
"now is the time"~wordPos("the") -> 3
"now is the time"~wordPos("The") -> 0
"now is the time"~wordPos("is the") -> 2
"now is the time"~wordPos("is the") -> 2
"now is the time"~wordPos("is time ") -> 0
"To be or not to be"~wordPos("be") -> 2
"To be or not to be"~wordPos("be",3) -> 6
</programlisting>
</section>
<section id="mthStringWords"><title>words</title>
<indexterm><primary>words method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>words method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>counting</primary>
<secondary>words in a string</secondary></indexterm>
<indexterm><primary>extracting</primary>
<secondary>words from a string</secondary></indexterm>
<indexterm><primary>word</primary>
<secondary>counting in a string</secondary></indexterm>
<indexterm><primary>word</primary>
<secondary>extracting from a string</secondary></indexterm>
<programlisting>
<![CDATA[
>>-words-------------------------------------------------------><
]]>
</programlisting>
<para>Returns the number of whitespace-delimited words in the receiving string.
</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>words method</secondary></indexterm>
<programlisting>
"Now is the time"~words -> 4
" "~words -> 0
</programlisting>
</section>
<section id="mthStringX2b"><title>x2b</title>
<indexterm><primary>x2b method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>x2b method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>hexadecimal to binary</secondary></indexterm>
<indexterm><primary>hexadecimal</primary>
<secondary>to binary, converting with X2B</secondary></indexterm>
<programlisting>
<![CDATA[
>>-x2b---------------------------------------------------------><
]]>
</programlisting>
<para>Returns a string, in character format, that represents the receiving
string, which is a string of hexadecimal characters converted to binary. The
receiving string can be of any length. Each hexadecimal character is converted
to a string of 4 binary digits. The receiving string can optionally include
whitespace characters (at byte boundaries only, not leading or trailing) to
improve readability; they are ignored.
</para>
<para>The returned string has a length that is a multiple of four, and does not
include any whitespace.</para>
<para>If the receiving string is null, the method returns a null string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>x2b method</secondary></indexterm>
<programlisting>
"C3"~x2b -> "11000011"
"7"~x2b -> "0111"
"1 C1"~x2b -> "000111000001"
</programlisting>
<para>You can combine <emphasis role="bold">x2b</emphasis>
with the methods <emphasis role="bold">d2x</emphasis> and
<emphasis role="bold">c2x</emphasis> to convert numbers or
character strings into binary form.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<programlisting>
"C3"x~c2x~x2b -> "11000011"
"129"~d2x~x2b -> "10000001"
"12"~d2x~x2b -> "1100"
</programlisting>
</section>
<section id="mthStringX2c"><title>x2c</title>
<indexterm><primary>x2c method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>x2c method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>hexadecimal to character</secondary></indexterm>
<indexterm><primary>hexadecimal</primary>
<secondary>to character, converting with X2C</secondary></indexterm>
<indexterm><primary>packing a string with X2C</primary></indexterm>
<programlisting>
<![CDATA[
>>-x2c---------------------------------------------------------><
]]>
</programlisting>
<para>Returns a string, in character format, that represents the receiving
string, which is a hexadecimal string converted to character. The returned string
is half as many bytes as the receiving string. The receiving string can be
any length. If necessary, it is padded with a leading 0 to make an even number
of hexadecimal digits.</para>
<para>You can optionally include whitespace in the receiving string (at byte
boundaries only, not leading or trailing) to improve readability; they are
ignored.
</para>
<para>If the receiving string is null, the method returns a null string.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>x2c method</secondary></indexterm>
<programlisting>
"4865 6c6c 6f"~x2c -> "Hello" /* ASCII */
"3732 73"~x2c -> "72s" /* ASCII */
</programlisting>
</section>
<section id="mthStringX2d"><title>x2d</title>
<indexterm><primary>x2d method</primary>
<secondary>of String class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>x2d method</secondary>
<tertiary>of String class</tertiary></indexterm>
<indexterm><primary>conversion</primary>
<secondary>hexadecimal to decimal</secondary></indexterm>
<indexterm><primary>hexadecimal</primary>
<secondary>to decimal, converting with X2D</secondary></indexterm>
<programlisting>
<![CDATA[
>>-x2d-+-----+-------------------------------------------------><
+-(n)-+
]]>
</programlisting>
<para>Returns the decimal representation of the receiving string, which is a
string of hexadecimal characters. If the result cannot be expressed as a whole
number, an error results. That is, the result must not have more digits than
the current setting of NUMERIC DIGITS.</para>
<para>You can optionally include whitespace characters in the receiving string
(at byte boundaries only, not leading or trailing) to improve readability; they
are ignored.
</para>
<para>If the receiving string is null, the method returns
<computeroutput>0</computeroutput>.</para>
<para>If you do not specify <emphasis role="italic">n</emphasis>,
the receiving string is processed as
an unsigned binary number.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>x2d method</secondary></indexterm>
<programlisting>
"0E"~x2d -> 14
"81"~x2d -> 129
"F81"~x2d -> 3969
"FF81"~x2d -> 65409
"46 30"X~x2d -> 240 /* ASCII */
"66 30"X~x2d -> 240 /* ASCII */
</programlisting>
<para>If you specify <emphasis role="italic">n</emphasis>, the receiving string
is taken as a signed number expressed in <emphasis role="italic">n</emphasis>
hexadecimal digits. If the leftmost bit is off, then
the number is positive; otherwise, it is a negative number. In both cases
it is converted to a whole number, which can be negative. If
<emphasis role="italic">n</emphasis> is <computeroutput>0</computeroutput>,
the method returns <computeroutput>0</computeroutput>.</para>
<para>If necessary, the receiving string is padded on the left with
<computeroutput>0</computeroutput> characters
(note, not &quot;sign-extended&quot;), or truncated on the left to
<emphasis role="italic">n</emphasis> characters.</para>
<para><emphasis role="bold">Examples:</emphasis></para>
<programlisting>
"81"~x2d(2) -> -127
"81"~x2d(4) -> 129
"F081"~x2d(4) -> -3967
"F081"~x2d(3) -> 129
"F081"~x2d(2) -> -127
"F081"~x2d(1) -> 1
"0031"~x2d(0) -> 0
</programlisting>
</section>
</section>
<section id="clsMethod"><title>The Method Class</title>
<indexterm><primary>Method class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Method class</secondary></indexterm>
<para>The Method class creates method objects from Rexx source code.
It is a subclass of the Object class (<xref linkend="clsObject" />).</para>
<figure><title>The Method class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxMethodClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The Method class also has available class methods that its
metaclass, the Class class, defines.</para></note>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />).</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mthMethodNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new(name,source--+-------------+---)-------------------><
+--, context--+
]]>
</programlisting>
<para>Returns a new instance of method class, which is an executable
representation of the code contained in the
<emphasis role="italic">source</emphasis>. The
<emphasis role="italic">name</emphasis> is a string.
The <emphasis role="italic">source</emphasis> can be a single string or an
array of strings containing individual method lines.</para>
<para>The <emphasis role="italic">context</emphasis> allows the created method
to inherit class and routine lookup scope from another source. If specified,
<emphasis role="italic">context</emphasis> can be a Method object, a Routine
object, a Package object, or the string "PROGRAMSCOPE". PROGRAMSCOPE is the
default, and specifies that the newly created method will inherit the class and
routine search scope from the caller of new method.
</para>
</section>
<section id="mthMethodNewFile"><title>newFile (Class Method)</title>
<indexterm><primary>newFile method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>newFile method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-newFile(filename)-------------------------------------------><
]]>
</programlisting>
<para>Returns a new instance of method class, which is an executable
representation of the code contained in the file filename. The filename is a
string.</para>
</section>
<section id="mthMethodLoadExternalMethod"><title>loadExternalMethod (Class Method)</title>
<indexterm><primary>loadExternalMethod method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>loadExternalMethod method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-loadExternalMethod(name,descriptor)------------------------><
]]>
</programlisting>
<para>Resolves a native method in an external library package and returns a
Method object instance that can used to call the external method. The
<emphasis role="italic">descriptor</emphasis> is a string containing
blank-delimited tokens that identify the location of the native method.
function. The first token identifies the type of native function and must be
"LIBRARY". The second token must identify
the name of the external library. The external library is located using
platform-specific mechanisms for loading libraries. For Unix-based systems, the
library name is case-sensitive. The third token is optional and specifies the
name of the method within the library package. If not specified,
<emphasis role="italic">name</emphasis> is used.
The method name is not case sensitive.
If the target method cannot be resolved, .nil is returned.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
method = .Method~loadExternalMethod("homeAddress=", 'LIBRARY mylib setHomeAddress')
</programlisting>
</section>
<section id="mthMethodIsGuarded"><title>isGuarded</title>
<indexterm><primary>isGuarded method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isGuarded method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<indexterm><primary>concurrency</primary>
<secondary>isGuarded method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-isGuarded--------------------------------------------------><
]]>
</programlisting>
<para>Returns true ("1") if the method is a Guarded method. Returns false ("0") for Unguarded methods.
</para>
</section>
<section id="mthMethodIsPrivate"><title>isPrivate</title>
<indexterm><primary>isPrivate method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isPrivate method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-isPrivate--------------------------------------------------><
]]>
</programlisting>
<para>Returns true ("1") if the method is a Private method. Returns false ("0") for Public methods.
See <xref linkend="pubpri" />
for details on private method restrictions.
</para>
</section>
<section id="mthMethodIsProtected"><title>isProtected</title>
<indexterm><primary>isProtected method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>isProtected method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-isProtected--------------------------------------------------><
]]>
</programlisting>
<para>Returns true ("1") if the method is a Protected method. Returns false ("0") for unprotected methods.
</para>
</section>
<section id="mthMethodPackage"><title>package</title>
<indexterm><primary>package method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>package method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-package-----------------------------------------------------><
]]>
</programlisting>
<para>Returns the Package class instance that defined the method instance. The
package instance controls and defines the search order for classes and routines
referenced by the method code.</para>
</section>
<section id="mthMethodSetGuarded"><title>setGuarded</title>
<indexterm><primary>setGuarded method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setGuarded method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<indexterm><primary>concurrency</primary>
<secondary>setGuarded method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-setGuarded--------------------------------------------------><
]]>
</programlisting>
<para>Specifies that the method is a guarded method that requires
exclusive access to its scope variable pool to run.
If the receiver is already guarded, a
<emphasis role="bold">setGuarded</emphasis> message has no effect.
Guarded is the default state for method objects.
</para>
</section>
<section id="mthMethodSetPrivate"><title>setPrivate</title>
<indexterm><primary>setPrivate method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setPrivate method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setPrivate--------------------------------------------------><
]]>
</programlisting>
<para>Specifies that a method is a private method.
By default, method objects are created as public methods.
See <xref linkend="pubpri" />
for details on private method restrictions.
</para>
</section>
<section id="mthMethodSetProtected"><title>setProtected</title>
<indexterm><primary>setProtected method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setProtected method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setProtected------------------------------------------------><
]]>
</programlisting>
<para>Specifies that a method is a protected method. Method objects are not
protected by default.
(See <xref linkend="secman" /> for details.)</para>
</section>
<section id="mthMethodSetSecurityManager"><title>setSecurityManager</title>
<indexterm><primary>setSecurityManager method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setSecurityManager method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setSecurityManager--+---------------------------+-----------><
+-(security_manager_object)-+
]]>
</programlisting>
<para>Replaces the existing security manager with the specified
<emphasis role="italic">security_manager_object</emphasis>. If
<emphasis role="italic">security_manager_object</emphasis> is omitted, any
existing security manager is removed.</para>
</section>
<section id="mthMethodSetUnguarded"><title>setUnguarded</title>
<indexterm><primary>setUnguarded method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setUnguarded method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<indexterm><primary>concurrency</primary>
<secondary>setUnguarded method</secondary></indexterm>
<programlisting>
<![CDATA[
>>-setUnguarded------------------------------------------------><
]]>
</programlisting>
<para>Turns off the guard attribute of the method, allowing this method to run
on an object even if another method has acquired exclusive access to the scope
variable pool. Methods are unguarded by default.</para>
<para>
A guarded method can be active for an object only when no other method requiring exclusive
access to the object's variable pool is active in the same object. This
restriction does not apply if an object sends itself a message to run a method
and it already has exclusive use of the same object variable pool. In this
case, the method runs immediately regardless of its guarded state.
</para>
</section>
<section id="mthMethodSource"><title>source</title>
<indexterm><primary>source method</primary>
<secondary>of Method class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>source method</secondary>
<tertiary>of Method class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-source------------------------------------------------------><
]]>
</programlisting>
<para>Returns the method source code as a single-index array of source
lines. If the source code is not available,
<emphasis role="bold">source</emphasis> returns an array of zero
items.</para>
</section>
</section>
<section id="clsRoutine"><title>The Routine Class</title>
<indexterm><primary>Routine class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Routine class</secondary></indexterm>
<para>The Routine class creates routine objects from Rexx source code.
It is a
subclass of the Object class (<xref linkend="clsObject" />).</para>
<figure><title>The Routine class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxRoutineClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The Routine class also has available class methods that its
metaclass, the Class class, defines.</para></note>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />).</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mthRoutineNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new(name,source--+-------------+---)-------------------><
+--, context--+
]]>
</programlisting>
<para>Returns a new instance of the routine class, which is an executable
representation of the code contained in the
<emphasis role="italic">source</emphasis>. The
<emphasis role="italic">name</emphasis> is a string.
The <emphasis role="italic">source</emphasis> can be a single string or an
array of strings containing individual method lines.</para>
<para>The <emphasis role="italic">context</emphasis> allows the created routine
to inherit class and routine lookup scope from another source. If specified,
<emphasis role="italic">context</emphasis> can be a Method object, a Routine
object, or a Package object. If not specified,
the newly created method will inherit the class and routine search scope from
the caller of new method.
</para>
</section>
<section id="mthRoutineNewFile"><title>newFile (Class Method)</title>
<indexterm><primary>newFile method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>newFile method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-newFile(filename)-------------------------------------------><
]]>
</programlisting>
<para>Returns a new instance of the routine class, which is an executable
representation of the code contained in the file filename. The filename is a
string.
</para>
</section>
<section id="mthRoutineLoadExternalRoutine"><title>loadExternalRoutine (Class method)</title>
<indexterm><primary>loadExternalRoutine method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>loadExternalRoutine method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-loadExternalRoutine(name,descriptor)------------------------><
]]>
</programlisting>
<para>Resolves a native routine in an external library package and returns a
Routine object instance that can used to call the external routine. The
<emphasis role="italic">descriptor</emphasis> is a string containing
blank-delimited tokens that identify the location of the native routine.
function. The first token identifies the type of native routine and must be
"LIBRARY". The second token must identify
the name of the external library. The external library is located using
platform-specific mechanisms for loading libraries. For Unix-based systems, the
library name is case-sensitive. The third token is optional and specifies the
name of the routine within the library package. If not specified,
<emphasis role="italic">name</emphasis> is used.
The routine name is not case sensitive. If the target routine cannot be
resolved, .nil is returned.
</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
routine = .Routine~loadExternalRoutine("Pi", "LIBRARY rxmath RxCalcPi")
</programlisting>
</section>
<section id="mthRoutineCall"><title>call</title>
<indexterm><primary>call method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>call method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-call-+--------------------+------------------------------------><
| +-,--------+ |
| V | |
+-(----argument-+--)-+
]]>
</programlisting>
<para>Calls the routine object using the provided arguments. The code in the
routine object is called as if it was an external routine call. The return
value will be any value returned by the executed routine.</para>
</section>
<section id="mthRoutineCallWith"><title>callWith</title>
<indexterm><primary>callWith method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>callWith method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-call(array)----------------------------------------------------><
]]>
</programlisting>
<para>Calls the routine object using the arguments provided in
<emphasis role="italic">array</emphasis>. Each element of array will be mapped
to its corresponding call argument. The code in the routine object is called as
if it was an external routine call. The return value will be any value returned
by the executed routine.
</para>
</section>
<section id="mthRoutinePackage"><title>package</title>
<indexterm><primary>package method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>package method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-package-----------------------------------------------------><
]]>
</programlisting>
<para>Returns the Package class instance that defined the routine instance. The
package instance controls and defines the search order for classes and routines
referenced by the routine code.</para>
</section>
<section id="mthRoutineSetSecurityManager"><title>setSecurityManager</title>
<indexterm><primary>setSecurityManager method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setSecurityManager method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setSecurityManager--+---------------------------+-----------><
+-(security_manager_object)-+
]]>
</programlisting>
<para>Replaces the existing security manager with the specified
<emphasis role="italic">security_manager_object</emphasis>. If
<emphasis role="italic">security_manager_object</emphasis> is omitted, any
existing security manager is removed.</para>
</section>
<section id="mthRoutineSource"><title>source</title>
<indexterm><primary>source method</primary>
<secondary>of Routine class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>source method</secondary>
<tertiary>of Routine class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-source------------------------------------------------------><
]]>
</programlisting>
<para>Returns the routine source code as a single-index array of source lines.
If the source code is not available,
<emphasis role="bold">source</emphasis> returns an array of zero
items.</para>
</section>
</section>
<section id="clsPackage"><title>The Package Class</title>
<indexterm><primary>Package class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Package class</secondary></indexterm>
<para>The Package class contains the source code for a package of Rexx code. A
package instance holds all of the routines, classes, and methods created from a
source code unit and also manages external dependencies referenced by ::REQUIRES
directives. The files loaded by ::REQUIRES are also contained in Package class
instances. It is a subclass of the Object class (<xref linkend="clsObject" />.
</para>
<figure><title>The Package class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxPackageClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The Package class also has available class methods that its metaclass, the
Class class, defines.
</para></note>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />).</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mthPackageNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new(name,source--+------------------+---)-------------------><
+--, methodobject--+
]]>
</programlisting>
<para>Returns a new instance of the package class, which is a representation of
the code contained in the
<emphasis role="italic">source</emphasis>. The
<emphasis role="italic">name</emphasis> is a string.
The <emphasis role="italic">source</emphasis> can be a single string or an
array of strings containing individual method lines.</para>
<para>The third parameter influences the scope of the routine. If none is given,
the program scope is used. If another method or routine object is specified, the
scope of the provided method or routine is used.
</para>
</section>
<section id="mthPackageAddClass"><title>addClass</title>
<indexterm><primary>addClass method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>addClass method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-addClass(name,class)----------------------------------------><
]]>
</programlisting>
<para>Adds the class object <emphasis role="italic">class</emphasis> to the
available classes under the name <emphasis role="italic">name</emphasis>. This
is added to the package as a non-public class.</para>
</section>
<section id="mthPackageAddPackage"><title>addPackage</title>
<indexterm><primary>addPackage method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>addPackage method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-addPackage(package)----------------------------------------><
]]>
</programlisting>
<para>Adds the package object <emphasis role="italic">package</emphasis> to the
dependent packages under the name
<emphasis role="italic">name</emphasis>.
The added package is processed as if it had been added using a ::REQUIRES
directive in the original package source.</para>
</section>
<section id="mthPackageAddPublicClass"><title>addPublicClass</title>
<indexterm><primary>addPublicClass method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>addPublicClass method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-addPublicClass(name,class)----------------------------------><
]]>
</programlisting>
<para>Adds the class object <emphasis role="italic">class</emphasis> to the
available public classes under the name <emphasis role="italic">name</emphasis>.
This is added to the package as a public class.</para>
</section>
<section id="mthPackageAddPublicRoutine"><title>addPublicRoutine</title>
<indexterm><primary>addPublicRoutine method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>addPublicRoutine method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-addPublicRoutine(name,routine)----------------------------------------><
]]>
</programlisting>
<para>Adds the routine object <emphasis role="italic">routine</emphasis> to the
available routines under the name
<emphasis role="italic">name</emphasis>. This is added to the package as a
public routine.</para>
</section>
<section id="mthPackageAddRoutine"><title>addRoutine</title>
<indexterm><primary>addRoutine method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>addRoutine method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-addRoutine(name,routine)----------------------------------------><
]]>
</programlisting>
<para>Adds the routine object <emphasis role="italic">routine</emphasis> to the
available routines under the name
<emphasis role="italic">name</emphasis>. This is added to the package as a
non-public routine.</para>
</section>
<section id="mthPackageClasses"><title>classes</title>
<indexterm><primary>classes method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>classes method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-classes----------------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all classes defined by this package or
imported as public classes from another package.</para>
</section>
<section id="mthPackageDefinedMethods"><title>definedMethods</title>
<indexterm><primary>definedMethods method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>definedMethods method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-definedMethods----------------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all unattached methods defined by this
package. This is the same directory available to code within the package via
the .METHODS environment symbol.</para>
</section>
<section id="mthPackageDigits"><title>digits</title>
<indexterm><primary>digits method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>digits method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-digits------------------------------------------------------><
]]>
</programlisting>
<para>Returns the initial NUMERIC DIGITS (<xref linkend="keyNumeric" />)
setting used for all Rexx code contained within the package. The default
value is 9. The ::OPTIONS (<xref linkend="optionsd" />) can
override the default value.
</para>
</section>
<section id="mthPackageFindClass"><title>findClass</title>
<indexterm><primary>findClass method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>findClass method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-findClass(name)---------------------------------------------><
]]>
</programlisting>
<para>Performs the standard environment symbol searches given class
<emphasis role="italic">name</emphasis>.
The search is performed using the same search mechanism used for environment
symbols or class names specified on ::CLASS directives.
If the name is not
found, .nil will be returned.</para>
</section>
<section id="mthPackageFindRoutine"><title>findRoutine</title>
<indexterm><primary>findRoutine method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>findRoutine method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-findRoutine(name)---------------------------------------------><
]]>
</programlisting>
<para>Searches for a routine within the package search order. This includes
::ROUTINE directives within the package, public routines imported from other
packages, or routines added using the addRoutine method. The argument
<emphasis role="italic">name</emphasis> must be a string object. If the name is
not found, .nil will be returned.</para>
</section>
<section id="mthPackageForm"><title>form</title>
<indexterm><primary>form method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>form method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-form--------------------------------------------------------><
]]>
</programlisting>
<para>Returns the initial NUMERIC FORM (<xref linkend="keyNumeric" />) setting
used for all Rexx code contained within the package. The default value is
SCIENTIFIC. The ::OPTIONS directive
(<xref linkend="optionsd" />) can override the default
value.
</para>
</section>
<section id="mthPackageFuzz"><title>fuzz</title>
<indexterm><primary>fuzz method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>fuzz method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-fuzz--------------------------------------------------------><
]]>
</programlisting>
<para>Returns the initial NUMERIC FUZZ (<xref linkend="keyNumeric" />) setting
used for all Rexx code contained within the package. The default value is 0.
The ::OPTIONS directive
(<xref linkend="optionsd" />) can override the default
value.
</para>
</section>
<section id="mthPackageImportedClasses"><title>importedClasses</title>
<indexterm><primary>importedClasses method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>importedClasses method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-importedClasses--------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all public classes imported from other
packages.</para>
</section>
<section id="mthPackageImportedPackages"><title>importedPackages</title>
<indexterm><primary>importedPackages method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>importedPackages method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-importedPackagess-------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all packages imported by the target package.
</para>
</section>
<section id="mthPackageImportedRoutines"><title>importedRoutines</title>
<indexterm><primary>importedRoutines method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>importedRoutines method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-importedRoutines-------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all public routines imported from other
packages.</para>
</section>
<section id="mthPackageLoadLibrary"><title>loadLibrary</title>
<indexterm><primary>loadLibrary method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>loadLibrary method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-loadLibrary(name)-----------------------------------------><
]]>
</programlisting>
<para>Loads a native library package and adds it to the list of libraries loaded
by the interpreter. The <emphasis role="italic">name</emphasis> identifies a
native external library file that will be located and loaded as if it had been
named on a ::REQUIRES LIBRARY directive. If the library is successfully loaded,
loadLibrary will return 1 (true), otherwise it returns 0 (false).</para>
</section>
<section id="mthPackageLoadPackage"><title>loadPackage</title>
<indexterm><primary>loadPackage method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>loadPackage method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-loadPackage(name-+---------+-)----------------------------><
+-,source-+
]]>
</programlisting>
<para>Loads a package and adds it to the list of packages loaded by the package
manager. If only <emphasis role="italic">name</emphasis> is specified,
<emphasis role="italic">name</emphasis> identifies a file that will be located
and loaded as if it had been named on a ::REQUIRES directive. If
<emphasis role="italic">source</emphasis> is given, it must be an array of
strings that is the source for the loaded package. If a package
<emphasis role="italic">name</emphasis> has already been loaded by the package
manager, the previously loaded version will be use. The resolved package object
will be added to the receiving package object's dependent packages.</para>
</section>
<section id="mthPackageName"><title>name</title>
<indexterm><primary>name method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>name method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-name-------------------------------------------------><
]]>
</programlisting>
<para>Returns the string name of the package.</para>
</section>
<section id="mthPackagePublicClasses"><title>publicClasses</title>
<indexterm><primary>publicClasses method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>publicClasses method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-publicClasses--------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all public classes defined in this package.</para>
</section>
<section id="mthPackagePublicRoutines"><title>publicRoutines</title>
<indexterm><primary>publicRoutines method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>publicRoutines method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-publicRoutines-------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all public routines defined in this
package.</para>
</section>
<section id="mthPackageRoutines"><title>routines</title>
<indexterm><primary>routines method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>routines method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-routines-------------------------------------><
]]>
</programlisting>
<para>Returns a directory containing all routines defined in this
package.</para>
</section>
<section id="mthPackageSetSecurityManager"><title>setSecurityManager</title>
<indexterm><primary>setSecurityManager method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>setSecurityManager method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-setSecurityManager--+---------------------------+-----------><
+-(security_manager_object)-+
]]>
</programlisting>
<para>Replaces the existing security manager with the specified
<emphasis role="italic">security_manager_object</emphasis>. If
<emphasis role="italic">security_manager_object</emphasis> is omitted, any
existing security manager is removed.</para>
</section>
<section id="mthPackageSource"><title>source</title>
<indexterm><primary>source method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>source method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-source------------------------------------------------------><
]]>
</programlisting>
<para>Returns the package source code as a single-index array of source lines.
If the source code is not available,
<emphasis role="bold">source</emphasis> returns an array of zero
items.</para>
</section>
<section id="mthPackageSourceLine"><title>sourceLine</title>
<indexterm><primary>sourceLine method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>sourceLine method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-sourceLine(n)------------------------------------------------------><
]]>
</programlisting>
<para>Returns the <emphasis role="italic">n</emphasis>th source line from the
package source. If the source code is not available or the indicated line does
not exist, a null string is returned.</para>
</section>
<section id="mthPackageSourceSize"><title>sourceSize</title>
<indexterm><primary>sourceSize method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>sourceSize method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-sourceSize---------------------------------------------------------><
]]>
</programlisting>
<para>Returns the size of the source code for the package object. If the source
code is not available, 0 is returned.</para>
</section>
<section id="mthPackageTrace"><title>trace</title>
<indexterm><primary>trace method</primary>
<secondary>of Package class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>trace method</secondary>
<tertiary>of Package class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-trace-------------------------------------------------------><
]]>
</programlisting>
<para>Returns the initial TRACE (<xref linkend="keyTrace" />) setting used for
all Rexx code contained within the package. The default value is Normal. The
::OPTIONS directive (<xref linkend="optionsd" />) can override the default
value.
</para>
</section>
</section>
<section id="clsMessage"><title>The Message Class</title>
<indexterm><primary>Message class</primary></indexterm>
<indexterm><primary>class</primary>
<secondary>Message class</secondary></indexterm>
<para>A message object provides for the deferred or
asynchronous sending of a message. You can create a message object by using
the <emphasis role="bold">new</emphasis>
method of the Message class or the
<emphasis role="bold">start</emphasis> (<xref linkend="mthObjectStart" />) method of the
Object class.
</para>
<figure><title>The Message class and methods</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/ooRexxMessageClass.png" />
</imageobject>
</mediaobject>
</figure>
<note><title>Note</title>
<para>The Message class also has available class methods that its
metaclass, the Class class (<xref linkend="clsClass" />), defines.</para></note>
<section><title>Inherited Methods</title>
<para>Methods inherited from the
Object class (<xref linkend="clsObject" />).</para>
<xi:include href="objectclassmethods.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mthMessageNew"><title>new (Class Method)</title>
<indexterm><primary>new method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>new method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-new(target,messagename-+-------------------------------+-)--><
| +---------------+ |
| V | |
+-,Individual---+-----------+-+-+
| +-,argument-+ |
+-,Array,argument---------------+
]]>
</programlisting>
<para>Initializes the message object for sending the message name
<emphasis role="italic">messagename</emphasis> to object
<emphasis role="italic">target</emphasis>.</para>
<para>The <emphasis role="italic">messagename</emphasis> can be a string or an
array. If <emphasis role="italic">messagename</emphasis> is an array object,
its first item is the name of the message and its
second item is a class object to use as the starting point for the method
search. For more information, see
<xref linkend="meths1" />.</para>
<para>If you specify the Individual or Array option, any remaining arguments
are arguments for the message. (You need to specify only the first letter;
all characters following the first are ignored.) </para>
<variablelist>
<varlistentry><term>Individual</term>
<listitem><para>If you specify this option, specifying
<emphasis role="italic">argument</emphasis> is optional.
Any <emphasis role="italic">argument</emphasis>s
are passed as message arguments
to <emphasis role="italic">target</emphasis> in the order you specify them.
</para></listitem></varlistentry>
<varlistentry><term>Array</term>
<listitem><para>If you specify this option, you must specify an
<emphasis role="italic">argument</emphasis>, which
is an array object. (See <xref linkend="clsArray" />.)
The member items of the array are passed to
<emphasis role="italic">target</emphasis> as arguments.
The first argument is
at index 1, the second argument at index 2, and so on. If you omitted any
indexes when creating the array, the
corresponding message arguments are also omitted.
</para></listitem></varlistentry>
</variablelist>
<para>If you specify neither Individual nor Array, the message sent has no
arguments. </para>
<note><title>Note</title>
<para>This method does not send the message
<emphasis role="italic">messagename</emphasis> to object
<emphasis role="italic">target</emphasis>. The SEND or START method
(described later) sends the message.
</para></note>
</section>
<section id="mthMessageArguments"><title>arguments</title>
<indexterm><primary>arguments method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>arguments method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-arguments----------------------------------------------><
]]>
</programlisting>
<para>Returns an array of argument objects used to invoke the message.</para>
</section>
<section id="mthMessageCompleted"><title>completed</title>
<indexterm><primary>completed method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>completed method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-completed---------------------------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> if the message object has
completed executing its message, or <computeroutput>0</computeroutput>. You can use this
method to test for completion as an alternative to calling
<emphasis role="bold">result</emphasis> and waiting for
the message to complete.</para>
</section>
<section id="mthMessageErrorCondition"><title>errorCondition</title>
<indexterm><primary>errorCondition method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>errorCondition method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-errorCondition----------------------------------------------><
]]>
</programlisting>
<para>Returns an error condition object from any execution error with the message
object's message invocation. If the message completed normally, or is still executing,
<emphasis role="bold">errorCondition</emphasis> returns the Nil object.</para>
</section>
<section id="mthMessageHasError"><title>hasError</title>
<indexterm><primary>hasError method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>hasError method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-hasError----------------------------------------------------><
]]>
</programlisting>
<para>Returns <computeroutput>1</computeroutput> if the message object's
message was terminated with an error condition. Returns
<computeroutput>0</computeroutput> if the message has not completed or
completed without error.</para>
</section>
<section id="mthMessageMessageName"><title>messageName</title>
<indexterm><primary>messageName method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>messageName method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-messageName----------------------------------------------><
]]>
</programlisting>
<para>Returns the string message name used to invoke a method.</para>
</section>
<section id="mthMessageNotify"><title>notify</title>
<indexterm><primary>notify method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>notify method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-notify(message)---------------------------------------------><
]]>
</programlisting>
<para>Requests notification about the completion of processing of the message
<emphasis role="bold">send</emphasis> or <emphasis role="bold">start</emphasis>.
The message object <emphasis role="italic">message</emphasis>
is sent as the notification. You can use
<emphasis role="bold">notify</emphasis> to request any number of
notifications. After the notification
message, you can use the <emphasis role="bold">result</emphasis>
method to obtain any result from the messages
<emphasis role="bold">send</emphasis> or
<emphasis role="bold">start</emphasis>.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<indexterm><primary>examples</primary>
<secondary>notify method</secondary></indexterm>
<programlisting>
/* Event-driven greetings */
.prompter~new~prompt(.nil)
::class prompter
::method prompt
expose name
use arg msg
if msg \= .nil then do
name = msg~result
if name = "quit" then return
say "Hello," name
end
say &apos;Enter your name ("quit" to quit):&apos;
/* Send the public default object .INPUT a LINEIN message asynchronously */
msg=.message~new(.input,"LINEIN")~~start
/* Sends self~prompt(msg) when data available */
msg~notify(.message~new(self,"PROMPT","I",msg))
/* Don&apos;t leave until user has entered "quit" */
guard on when name="quit"
</programlisting>
</section>
<section id="mthMessageResult"><title>result</title>
<indexterm><primary>result method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>result method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-result------------------------------------------------------><
]]>
</programlisting>
<para>Returns the result of the message <emphasis role="bold">send</emphasis> or
<emphasis role="bold">start</emphasis>.
If message processing is not yet complete, this method waits until it completes.
If the message <emphasis role="bold">send</emphasis> or
<emphasis role="bold">start</emphasis> raises an error condition, this method
also raises an error condition.</para>
<para><emphasis role="bold">Example:</emphasis></para>
<programlisting>
/* Example using result method */
string="700" /* Create a new string object, string */
bond=string~start("reverse") /* Create a message object, bond, and */
/* start it. This sends a REVERSE */
/* message to string, giving bond */
/* the result. */
/* Ask bond for the result of the message */
say "The result of message was" bond~result /* Result is 007 */
</programlisting>
</section>
<section id="mthMessageSend"><title>send</title>
<indexterm><primary>send method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>send method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-send--+----------+------------------------------------------><
+-(target)-+
]]>
</programlisting>
<para>Returns the result (if any) of sending the message. If you specify
<emphasis role="italic">target</emphasis>, this method sends the message to
<emphasis role="italic">target</emphasis>. Otherwise,
this method sends the message to the <emphasis role="italic">target</emphasis>
you specified when the message object was created.
<emphasis role="bold">send</emphasis> does
not return until message processing is complete.</para>
<para>You can use the <emphasis role="bold">notify</emphasis>
method to request notification that message
processing is complete. You can use the
<emphasis role="bold">result</emphasis> method to obtain any result
from the message.</para>
</section>
<section id="mthMessageStart"><title>start</title>
<indexterm><primary>start method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>start method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-start--+----------+-----------------------------------------><
+-(target)-+
]]>
</programlisting>
<para>Sends the message to start processing at a specific target whereas
the sender continues processing. If you specify
<emphasis role="italic">target</emphasis>, this method
sends the message to <emphasis role="italic">target</emphasis>. Otherwise, this
method sends the message to the <emphasis role="italic">target</emphasis>
that you specified when the message object was created.
This method returns as soon as possible and does not wait until
message processing is complete. When message processing is complete, the
message object retains any result and holds it until requested via
the <emphasis role="bold">result</emphasis>
method. You can use the <emphasis role="bold">notify</emphasis> method to request
notification when message processing completes.</para>
</section>
<section id="exam"><title>Example</title>
<indexterm><primary>examples</primary>
<secondary>start method</secondary></indexterm>
<indexterm><primary>examples</primary>
<secondary>of Message class</secondary></indexterm>
<programlisting>
/* Using Message class methods */
/* Note: In the following example, ::METHOD directives define class Testclass */
/* with method SHOWMSG */
ez=.testclass~new /* Creates a new instance of Testclass */
mymsg=ez~start("SHOWMSG","Hello, Ollie!",5) /* Creates and starts */
/* message mymsg to send */
/* SHOWMSG to ez */
/* Continue with main processing while SHOWMSG runs concurrently */
do 5
say "Hello, Stan!"
end
/* Get final result of the SHOWMSG method from the mymsg message object */
say mymsg~result
say "Goodbye, Stan..."
exit
::class testclass public /* Directive defines Testclass */
::method showmsg /* Directive creates new method SHOWMSG */
use arg text,reps /* class Testclass */
do reps
say text
end
reply "Bye Bye, Ollie..."
return
</programlisting>
<para>The following output is possible: </para>
<programlisting>
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Hello, Ollie!
Hello, Stan!
Bye Bye, Ollie...
Goodbye, Stan...
</programlisting>
</section>
<section id="mthMessageTarget"><title>target</title>
<indexterm><primary>target method</primary>
<secondary>of Message class</secondary></indexterm>
<indexterm><primary>method</primary>
<secondary>target method</secondary>
<tertiary>of Message class</tertiary></indexterm>
<programlisting>
<![CDATA[
>>-target---------------------------------------------------><
]]>
</programlisting>
<para>Returns the object that is the target of the invoked message.</para>
</section>
</section>
</section>