This file is indexed.

/usr/share/doc/maxima-doc/html/maxima_77.html is in maxima-doc 5.32.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Maxima 5.32.1 Manual: 77. stringproc</title>

<meta name="description" content="Maxima 5.32.1 Manual: 77. stringproc">
<meta name="keywords" content="Maxima 5.32.1 Manual: 77. stringproc">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
    color: black;
    background: white; 
    margin-left: 8%;
    margin-right: 13%;
}

h1
{
    margin-left: +8%;
    font-size: 150%;
    font-family: sans-serif
}

h2
{
    font-size: 125%;
    font-family: sans-serif
}

h3
{
    font-size: 100%;
    font-family: sans-serif
}

h2,h3,h4,h5,h6 { margin-left: +4%; }

div.textbox
{
    border: solid;
    border-width: thin;
    /* width: 100%; */
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em
}

div.titlebox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
    background: rgb(200,255,255);
    font-family: sans-serif
}

div.synopsisbox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
     background: rgb(255,220,255);
    /*background: rgb(200,255,255); */
    /* font-family: fixed */
}

pre.example
{
    border: 1px solid gray;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 1em;
    padding-right: 1em;
    /* background: rgb(247,242,180); */ /* kind of sandy */
    /* background: rgb(200,255,255); */ /* sky blue */
    background-color: #F1F5F9; /* light blue-gray */
    /* font-family: "Lucida Console", monospace */
}

div.spacerbox
{
    border: none;
    padding-top: 2em;
    padding-bottom: 2em
}

div.image
{
    margin: 0;
    padding: 1em;
    text-align: center;
}

div.categorybox
{
    border: 1px solid gray;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 1em;
    padding-right: 1em;
    background: rgb(247,242,220);
}


-->
</style>

<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="stringproc"></a>
<a name="SEC361"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_76.html#SEC360" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC362" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima_76.html#SEC359" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 77. stringproc </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC362">77.1 Introduction to string processing</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC363">77.2 Functions and Variables for input and output</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC364">77.3 Functions and Variables for characters</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC365">77.4 Functions and Variables for strings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<p><a name="Item_003a-Introduction-to-string-processing"></a>
</p><hr size="6">
<a name="Introduction-to-string-processing"></a>
<a name="SEC362"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC361" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC363" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC361" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC361" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.1 Introduction to string processing </h2>

<p><code>stringproc.lisp</code> enlarges Maximas capabilities of working with strings 
and adds some useful functions for file in/output.
</p>
<p>For questions and bugs please mail to volkervannek at gmail dot com .
</p>
<p>In Maxima a string is easily constructed by typing &quot;text&quot;.
<code>stringp</code> tests for strings.
</p>
<pre class="example">(%i1) m: &quot;text&quot;;
(%o1)                         text
(%i2) stringp(m);
(%o2)                         true
</pre>
<p>Characters are represented as strings of length 1.
These are not Lisp characters.
Tests can be done with <code>charp</code> (respectively <code>lcharp</code>
and conversion from Lisp to Maxima characters with <code>cunlisp</code>).
</p>

<pre class="example">(%i1) c: &quot;e&quot;;
(%o1)                           e
(%i2) [charp(c),lcharp(c)];
(%o2)                     [true, false]
(%i3) supcase(c);
(%o3)                           E
(%i4) charp(%);
(%o4)                         true
</pre>
<p>All functions in <code>stringproc.lisp</code> that return characters, return Maxima-characters.
Due to the fact, that the introduced characters are strings of length 1,
you can use a lot of string functions also for characters.
As seen, <code>supcase</code> is one example.
</p>
<p>It is important to know,
that the first character in a Maxima-string is at position 1.
This is designed due to the fact that the first element in a Maxima-list is at position 1 too.
See definitions of <code>charat</code> and <code>charlist</code> for examples.
</p>
<p>In applications string-functions are often used when working with files.
You will find some useful stream- and print-functions in <code>stringproc.lisp</code>.
The following example shows some of the here introduced functions at work.
</p>
<p>Example: 
</p>
<p><code>openw</code> returns an output stream to a file, <code>printf</code> then allows formatted writing 
to this file. See <code>printf</code> for details.
</p>
<pre class="example">(%i1) s: openw(&quot;E:/file.txt&quot;);
(%o1)                    #&lt;output stream E:/file.txt&gt;
(%i2) for n:0 thru 10 do printf( s, &quot;~d &quot;, fib(n) );
(%o2)                                done
(%i3) printf( s, &quot;~%~d ~f ~a ~a ~f ~e ~a~%&quot;, 
              42,1.234,sqrt(2),%pi,1.0e-2,1.0e-2,1.0b-2 );
(%o3)                                false
(%i4) close(s);
(%o4)                                true
</pre>
<p>After closing the stream you can open it again, this time with input direction. 
<code>readline</code> returns the entire line as one string. The <code>stringproc</code> package 
now offers a lot of functions for manipulating strings. Tokenizing can be done by 
<code>split</code> or <code>tokens</code>.
</p>
<pre class="example">(%i5) s: openr(&quot;E:/file.txt&quot;);
(%o5)                     #&lt;input stream E:/file.txt&gt;
(%i6) readline(s);
(%o6)                     0 1 1 2 3 5 8 13 21 34 55 
(%i7) line: readline(s);
(%o7)               42 1.234 sqrt(2) %pi 0.01 1.0E-2 1.0b-2
(%i8) list: tokens(line);
(%o8)           [42, 1.234, sqrt(2), %pi, 0.01, 1.0E-2, 1.0b-2]
(%i9) map( parse_string, list );
(%o9)            [42, 1.234, sqrt(2), %pi, 0.01, 0.01, 1.0b-2]
(%i10) float(%);
(%o10) [42.0, 1.234, 1.414213562373095, 3.141592653589793, 0.01,
                                                     0.01, 0.01]
(%i11) readline(s);
(%o11)                               false
(%i12) close(s)$
</pre>
<p><code>readline</code> returns <code>false</code> when the end of file occurs.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Strings} &middot;
@ref{Category: Share packages} &middot;
@ref{Category: Package stringproc}
</div>
</p>

<p><a name="Item_003a-Functions-and-Variables-for-input-and-output"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-input-and-output"></a>
<a name="SEC363"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC362" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC364" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC361" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC361" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.2 Functions and Variables for input and output </h2>

<p>Example: 
</p>
<pre class="example">(%i1) s: openw(&quot;E:/file.txt&quot;);
(%o1)                     #&lt;output stream E:/file.txt&gt;
(%i2) control: 
&quot;~2tAn atom: ~20t~a~%~2tand a list: ~20t~{~r ~}~%~2t\
and an integer: ~20t~d~%&quot;$
(%i3) printf( s,control, 'true,[1,2,3],42 )$
(%o3)                                false
(%i4) close(s);
(%o4)                                true
(%i5) s: openr(&quot;E:/file.txt&quot;);
(%o5)                     #&lt;input stream E:/file.txt&gt;
(%i6) while stringp( tmp:readline(s) ) do print(tmp)$
  An atom:          true 
  and a list:       one two three  
  and an integer:   42 
(%i7) close(s)$
</pre>
<p><a name="Item_003a-close"></a>
</p><dl>
<dt><u>Function:</u> <b>close</b><i> (<var>stream</var>) </i>
<a name="IDX2709"></a>
</dt>
<dd><p>Closes <var>stream</var> and returns <code>true</code> if <var>stream</var> had been open. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-flength"></a>
</p><dl>
<dt><u>Function:</u> <b>flength</b><i> (<var>stream</var>)</i>
<a name="IDX2710"></a>
</dt>
<dd><p>Returns the number of elements in <var>stream</var>
where <var>stream</var> has to be a stream from or to a file. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-fposition"></a>
</p><dl>
<dt><u>Function:</u> <b>fposition</b><i> (<var>stream</var>)</i>
<a name="IDX2711"></a>
</dt>
<dt><u>Function:</u> <b>fposition</b><i> (<var>stream</var>, <var>pos</var>)</i>
<a name="IDX2712"></a>
</dt>
<dd><p>Returns the current position in <var>stream</var>, if <var>pos</var> is not used. 
If <var>pos</var> is used, <code>fposition</code> sets the position in <var>stream</var>.
<var>stream</var> has to be a stream from or to a file and 
<var>pos</var> has to be a positive number where the first element in <var>stream</var> 
is in position 1.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-freshline"></a>
</p><dl>
<dt><u>Function:</u> <b>freshline</b><i> () </i>
<a name="IDX2713"></a>
</dt>
<dt><u>Function:</u> <b>freshline</b><i> (<var>stream</var>) </i>
<a name="IDX2714"></a>
</dt>
<dd><p>Writes a new line (to <var>stream</var>),
if the position is not at the beginning of a line.
See also <code>newline</code>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="get_005foutput_005fstream_005fstring"></a>
<a name="Item_003a-get_005foutput_005fstream_005fstring"></a>
</p><dl>
<dt><u>Function:</u> <b>get_output_stream_string</b><i> (<var>stream</var>)</i>
<a name="IDX2715"></a>
</dt>
<dd><p>Returns a string containing all the characters currently present in 
<var>stream</var> which must be an open string-output stream. 
The returned characters are removed from <var>stream</var>.
</p>
<p>Example: See <a href="#make_005fstring_005foutput_005fstream">make_string_output_stream</a> .
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="make_005fstring_005finput_005fstream"></a>
<a name="Item_003a-make_005fstring_005finput_005fstream"></a>
</p><dl>
<dt><u>Function:</u> <b>make_string_input_stream</b><i> (<var>string</var>)</i>
<a name="IDX2716"></a>
</dt>
<dt><u>Function:</u> <b>make_string_input_stream</b><i> (<var>string</var>, <var>start</var>)</i>
<a name="IDX2717"></a>
</dt>
<dt><u>Function:</u> <b>make_string_input_stream</b><i> (<var>string</var>, <var>start</var>, <var>end</var>)</i>
<a name="IDX2718"></a>
</dt>
<dd><p>Returns an input stream which contains parts of <var>string</var> and an end of file. 
Without optional arguments the stream contains the entire string 
and is positioned in front of the first character. 
<var>start</var> and <var>end</var> define the substring contained in the stream. 
The first character is available at position 1.
</p> 
<pre class="example">(%i1) istream : make_string_input_stream(&quot;text&quot;, 1, 4);
(%o1)              #&lt;string-input stream from &quot;text&quot;&gt;
(%i2) (while (c : readchar(istream)) # false do sprint(c), newline())$
t e x 
(%i3) close(istream)$
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="make_005fstring_005foutput_005fstream"></a>
<a name="Item_003a-make_005fstring_005foutput_005fstream"></a>
</p><dl>
<dt><u>Function:</u> <b>make_string_output_stream</b><i> ()</i>
<a name="IDX2719"></a>
</dt>
<dd><p>Returns an output stream that accepts characters. Characters currently present 
in this stream can be retrieved by <a href="#get_005foutput_005fstream_005fstring">get_output_stream_string</a>.
</p> 
<pre class="example">(%i1) ostream : make_string_output_stream();
(%o1)               #&lt;string-output stream 09622ea0&gt;
(%i2) printf(ostream, &quot;foo&quot;)$

(%i3) printf(ostream, &quot;bar&quot;)$

(%i4) string : get_output_stream_string(ostream);
(%o4)                            foobar
(%i5) printf(ostream, &quot;baz&quot;)$

(%i6) string : get_output_stream_string(ostream);
(%o6)                              baz
(%i7) close(ostream)$
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-newline"></a>
</p><dl>
<dt><u>Function:</u> <b>newline</b><i> () </i>
<a name="IDX2720"></a>
</dt>
<dt><u>Function:</u> <b>newline</b><i> (<var>stream</var>) </i>
<a name="IDX2721"></a>
</dt>
<dd><p>Writes a new line (to <var>stream</var>).
See <code>sprint</code> for an example of using <code>newline()</code>.
Note that there are some cases, where <code>newline()</code> does not work as expected. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-opena"></a>
</p><dl>
<dt><u>Function:</u> <b>opena</b><i> (<var>file</var>) </i>
<a name="IDX2722"></a>
</dt>
<dd><p>Returns an output stream to <var>file</var>.
If an existing file is opened, <code>opena</code> appends elements at the end of file.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-openr"></a>
</p><dl>
<dt><u>Function:</u> <b>openr</b><i> (<var>file</var>) </i>
<a name="IDX2723"></a>
</dt>
<dd><p>Returns an input stream to <var>file</var>.
If <var>file</var> does not exist, it will be created.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-openw"></a>
</p><dl>
<dt><u>Function:</u> <b>openw</b><i> (<var>file</var>) </i>
<a name="IDX2724"></a>
</dt>
<dd><p>Returns an output stream to <var>file</var>.
If <var>file</var> does not exist, it will be created.
If an existing file is opened, <code>openw</code> destructively modifies <var>file</var>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-printf"></a>
</p><dl>
<dt><u>Function:</u> <b>printf</b><i> (<var>dest</var>, <var>string</var>)</i>
<a name="IDX2725"></a>
</dt>
<dt><u>Function:</u> <b>printf</b><i> (<var>dest</var>, <var>string</var>, <var>expr_1</var>, ..., <var>expr_n</var>)</i>
<a name="IDX2726"></a>
</dt>
<dd><p>Produces formatted output by outputting the characters of control-string 
<var>string</var> and observing that a tilde introduces a directive.
The character after the tilde, possibly preceded by prefix parameters 
and modifiers, specifies what kind of formatting is desired.
Most directives use one or more elements of the arguments 
<var>expr_1</var>, ..., <var>expr_n</var> to create their output.
</p>
<p>If <var>dest</var> is a stream or <code>true</code>, then <code>printf</code> returns <code>false</code>.
Otherwise, <code>printf</code> returns a string containing the output.
</p>
<p><code>printf</code> provides the Common Lisp function <code>format</code> in Maxima. 
The following example illustrates the general relation between these two 
functions.
</p>
<pre class="example">(%i1) printf(true, &quot;R~dD~d~%&quot;, 2, 2);
R2D2
(%o1)                                false
(%i2) :lisp (format t &quot;R~dD~d~%&quot; 2 2)
R2D2
NIL
</pre>
<p>The following description is limited to a rough sketch of the possibilities of 
<code>printf</code>.
The Lisp function <code>format</code> is described in detail in many reference books. 
Of good help is e.g. the free available online-manual 
&quot;Common Lisp the Language&quot; by Guy L. Steele. See chapter 22.3.3 there. 
</p>
<pre class="example">   ~%       new line
   ~&amp;       fresh line
   ~t       tab
   ~$       monetary
   ~d       decimal integer
   ~b       binary integer
   ~o       octal integer
   ~x       hexadecimal integer
   ~br      base-b integer
   ~r       spell an integer
   ~p       plural
   ~f       floating point
   ~e       scientific notation
   ~g       ~f or ~e, depending upon magnitude
   ~h       bigfloat
   ~a       uses Maxima function string
   ~s       like ~a, but output enclosed in &quot;double quotes&quot;
   ~~       ~
   ~&lt;       justification, ~&gt; terminates
   ~(       case conversion, ~) terminates 
   ~[       selection, ~] terminates 
   ~{       iteration, ~} terminates
</pre>
<p>The directive ~h for bigfloat is no Lisp-standard and is therefore illustrated below. 
</p>
<p>Note that the directive ~* is not supported.
</p>
<p>If <var>dest</var> is a stream or <code>true</code>, then <code>printf</code> returns <code>false</code>.
Otherwise, <code>printf</code> returns a string containing the output.
</p>
<pre class="example">(%i1) printf( false, &quot;~a ~a ~4f ~a ~@r&quot;, 
              &quot;String&quot;,sym,bound,sqrt(12),144), bound = 1.234;
(%o1)                 String sym 1.23 2*sqrt(3) CXLIV
(%i2) printf( false,&quot;~{~a ~}&quot;,[&quot;one&quot;,2,&quot;THREE&quot;] );
(%o2)                          one 2 THREE 
(%i3) printf(true,&quot;~{~{~9,1f ~}~%~}&quot;,mat ),
          mat = args(matrix([1.1,2,3.33],[4,5,6],[7,8.88,9]))$
      1.1       2.0       3.3 
      4.0       5.0       6.0 
      7.0       8.9       9.0 
(%i4) control: &quot;~:(~r~) bird~p ~[is~;are~] singing.&quot;$
(%i5) printf( false,control, n,n,if n=1 then 1 else 2 ), n=2;
(%o5)                    Two birds are singing.
</pre>
<p>The directive ~h has been introduced to handle bigfloats. 
</p>
<pre class="example">~w,d,e,x,o,p@H
 w : width
 d : decimal digits behind floating point
 e : minimal exponent digits
 x : preferred exponent
 o : overflow character
 p : padding character
 @ : display sign for positive numbers
</pre>
<pre class="example">(%i1) fpprec : 1000$
(%i2) printf(true, &quot;|~h|~%&quot;, 2.b0^-64)$
|0.0000000000000000000542101086242752217003726400434970855712890625|
(%i3) fpprec : 26$
(%i4) printf(true, &quot;|~h|~%&quot;, sqrt(2))$
|1.4142135623730950488016887|
(%i5) fpprec : 24$
(%i6) printf(true, &quot;|~h|~%&quot;, sqrt(2))$
|1.41421356237309504880169|
(%i7) printf(true, &quot;|~28h|~%&quot;, sqrt(2))$
|   1.41421356237309504880169|
(%i8) printf(true, &quot;|~28,,,,,'*h|~%&quot;, sqrt(2))$
|***1.41421356237309504880169|
(%i9) printf(true, &quot;|~,18h|~%&quot;, sqrt(2))$
|1.414213562373095049|
(%i10) printf(true, &quot;|~,,,-3h|~%&quot;, sqrt(2))$
|1414.21356237309504880169b-3|
(%i11) printf(true, &quot;|~,,2,-3h|~%&quot;, sqrt(2))$
|1414.21356237309504880169b-03|
(%i12) printf(true, &quot;|~20h|~%&quot;, sqrt(2))$
|1.41421356237309504880169|
(%i13) printf(true, &quot;|~20,,,,'+h|~%&quot;, sqrt(2))$
|++++++++++++++++++++|
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: File output} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="readchar"></a>
<a name="Item_003a-readchar"></a>
</p><dl>
<dt><u>Function:</u> <b>readchar</b><i> (<var>stream</var>)</i>
<a name="IDX2727"></a>
</dt>
<dd><p>Removes and returns the first character in <var>stream</var>. 
If the end of file is encountered <code>readchar</code> returns <code>false</code>.
</p>
<p>Example: See <a href="#make_005fstring_005finput_005fstream">make_string_input_stream</a>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-readline"></a>
</p><dl>
<dt><u>Function:</u> <b>readline</b><i> (<var>stream</var>) </i>
<a name="IDX2728"></a>
</dt>
<dd><p>Returns a string containing the characters from the current position 
in <var>stream</var> up to the end of the line or <code>false</code> 
if the end of the file is encountered.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: File input} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="sprint"></a>
<a name="Item_003a-sprint"></a>
</p><dl>
<dt><u>Function:</u> <b>sprint</b><i> (<var>expr_1</var>, &hellip;, <var>expr_n</var>)</i>
<a name="IDX2729"></a>
</dt>
<dd><p>Evaluates and displays its arguments one after the other `on a line' starting at
the leftmost position.  The numbers are printed with the '-' right next to the
number, and it disregards line length.  <code>newline()</code>, which will be
autoloaded from <code>stringproc.lisp</code> might be useful, if you whish to place
intermediate line breaking.
</p>
<p>Example:
</p>
<pre class="example">(%i1) for n:0 thru 19 do sprint( fib(n) )$
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
(%i2) for n:0 thru 22 do ( 
         sprint(fib(n)), if mod(n,10)=9 then newline() )$
0 1 1 2 3 5 8 13 21 34 
55 89 144 233 377 610 987 1597 2584 4181 
6765 10946 17711 
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p></dd></dl>

<p><a name="Item_003a-Functions-and-Variables-for-characters"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-characters"></a>
<a name="SEC364"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC363" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC365" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC361" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC361" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.3 Functions and Variables for characters </h2>

<p><a name="Item_003a-alphacharp"></a>
</p><dl>
<dt><u>Function:</u> <b>alphacharp</b><i> (<var>char</var>)    </i>
<a name="IDX2730"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is an alphabetic character. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-alphanumericp"></a>
</p><dl>
<dt><u>Function:</u> <b>alphanumericp</b><i> (<var>char</var>) </i>
<a name="IDX2731"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is an alphabetic character or a digit. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-ascii"></a>
</p><dl>
<dt><u>Function:</u> <b>ascii</b><i> (<var>int</var>) </i>
<a name="IDX2732"></a>
</dt>
<dd><p>Returns the character corresponding to the ASCII number <var>int</var>.
( -1 &lt; int &lt; 256 )
</p>
<pre class="example">(%i1) for n from 0 thru 255 do ( 
   tmp: ascii(n), if alphacharp(tmp) then sprint(tmp),
      if n=96 then newline() )$
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
a b c d e f g h i j k l m n o p q r s t u v w x y z
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cequal"></a>
</p><dl>
<dt><u>Function:</u> <b>cequal</b><i> (<var>char_1</var>, <var>char_2</var>)          </i>
<a name="IDX2733"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char_1</var> and <var>char_2</var> are the same. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cequalignore"></a>
</p><dl>
<dt><u>Function:</u> <b>cequalignore</b><i> (<var>char_1</var>, <var>char_2</var>)    </i>
<a name="IDX2734"></a>
</dt>
<dd><p>Like <code>cequal</code> but ignores case. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cgreaterp"></a>
</p><dl>
<dt><u>Function:</u> <b>cgreaterp</b><i> (<var>char_1</var>, <var>char_2</var>)       </i>
<a name="IDX2735"></a>
</dt>
<dd><p>Returns <code>true</code> if the ASCII number of <var>char_1</var> is greater than the number of <var>char_2</var>. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cgreaterpignore"></a>
</p><dl>
<dt><u>Function:</u> <b>cgreaterpignore</b><i> (<var>char_1</var>, <var>char_2</var>)</i>
<a name="IDX2736"></a>
</dt>
<dd><p>Like <code>cgreaterp</code> but ignores case. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-charp"></a>
</p><dl>
<dt><u>Function:</u> <b>charp</b><i> (<var>obj</var>) </i>
<a name="IDX2737"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>obj</var> is a Maxima-character.
See introduction for example.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cint"></a>
</p><dl>
<dt><u>Function:</u> <b>cint</b><i> (<var>char</var>) </i>
<a name="IDX2738"></a>
</dt>
<dd><p>Returns the ASCII number of <var>char</var>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-clessp"></a>
</p><dl>
<dt><u>Function:</u> <b>clessp</b><i> (<var>char_1</var>, <var>char_2</var>)</i>
<a name="IDX2739"></a>
</dt>
<dd><p>Returns <code>true</code> if the ASCII number of <var>char_1</var> is less than the number of <var>char_2</var>. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-clesspignore"></a>
</p><dl>
<dt><u>Function:</u> <b>clesspignore</b><i> (<var>char_1</var>, <var>char_2</var>)</i>
<a name="IDX2740"></a>
</dt>
<dd><p>Like <code>clessp</code> but ignores case. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-constituent"></a>
</p><dl>
<dt><u>Function:</u> <b>constituent</b><i> (<var>char</var>)   </i>
<a name="IDX2741"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is a graphic character and not the space character.
A graphic character is a character one can see, plus the space character.
(<code>constituent</code> is defined by Paul Graham, ANSI Common Lisp, 1996, page 67.)
</p>
<pre class="example">(%i1) for n from 0 thru 255 do ( 
tmp: ascii(n), if constituent(tmp) then sprint(tmp) )$
! &quot; #  %  ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; &lt; = &gt; ? @ A B
C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c
d e f g h i j k l m n o p q r s t u v w x y z { | } ~
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-cunlisp"></a>
</p><dl>
<dt><u>Function:</u> <b>cunlisp</b><i> (<var>lisp_char</var>) </i>
<a name="IDX2742"></a>
</dt>
<dd><p>Converts a Lisp-character into a Maxima-character.
(You won't need it.)
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-digitcharp"></a>
</p><dl>
<dt><u>Function:</u> <b>digitcharp</b><i> (<var>char</var>)    </i>
<a name="IDX2743"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is a digit. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-lcharp"></a>
</p><dl>
<dt><u>Function:</u> <b>lcharp</b><i> (<var>obj</var>) </i>
<a name="IDX2744"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>obj</var> is a Lisp-character.
(You won't need it.)
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-lowercasep"></a>
</p><dl>
<dt><u>Function:</u> <b>lowercasep</b><i> (<var>char</var>)    </i>
<a name="IDX2745"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is a lowercase character. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>


<dl>
<dt><u>Variable:</u> <b>newline</b>
<a name="IDX2746"></a>
</dt>
<dd><p>The newline character. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Global variables} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-space"></a>
</p><dl>
<dt><u>Variable:</u> <b>space</b>
<a name="IDX2747"></a>
</dt>
<dd><p>The space character.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Global variables} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-tab"></a>
</p><dl>
<dt><u>Variable:</u> <b>tab</b>
<a name="IDX2748"></a>
</dt>
<dd><p>The tab character.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Global variables} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-uppercasep"></a>
</p><dl>
<dt><u>Function:</u> <b>uppercasep</b><i> (<var>char</var>)    </i>
<a name="IDX2749"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>char</var> is an uppercase character. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-Functions-and-Variables-for-strings"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-strings"></a>
<a name="SEC365"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC364" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC361" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC361" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 77.4 Functions and Variables for strings </h2>

<p><a name="base64"></a>
<a name="Item_003a-base64"></a>
</p><dl>
<dt><u>Function:</u> <b>base64</b><i> (<var>string</var>)</i>
<a name="IDX2750"></a>
</dt>
<dd><p>Returns the base64-representation of <var>string</var> as a string.
</p>
<p>Example:
</p>
<pre class="example">(%i1) base64 : base64(&quot;foo bar baz&quot;);
(%o1)                       Zm9vIGJhciBiYXo=
(%i2) string : base64_decode(base64);
(%o2)                          foo bar baz
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="base64_005fdecode"></a>
<a name="Item_003a-base64_005fdecode"></a>
</p><dl>
<dt><u>Function:</u> <b>base64_decode</b><i> (<var>base64-string</var>)</i>
<a name="IDX2751"></a>
</dt>
<dd><p>Decodes the string <var>base64-string</var> coded in base64 back to the original string.
</p>
<p>Example: See <a href="#base64">base64</a>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-charat"></a>
</p><dl>
<dt><u>Function:</u> <b>charat</b><i> (<var>string</var>, <var>n</var>) </i>
<a name="IDX2752"></a>
</dt>
<dd><p>Returns the <var>n</var>-th character of <var>string</var>.
The first character in <var>string</var> is returned with <var>n</var> = 1.
</p>
<pre class="example">(%i1) charat(&quot;Lisp&quot;,1);
(%o1)                           L
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-charlist"></a>
</p><dl>
<dt><u>Function:</u> <b>charlist</b><i> (<var>string</var>) </i>
<a name="IDX2753"></a>
</dt>
<dd><p>Returns the list of all characters in <var>string</var>. 
</p>
<pre class="example">(%i1) charlist(&quot;Lisp&quot;);
(%o1)                     [L, i, s, p]
(%i2) %[1];
(%o2)                           L
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-eval_005fstring"></a>
</p><dl>
<dt><u>Function:</u> <b>eval_string</b><i> (<var>str</var>)</i>
<a name="IDX2754"></a>
</dt>
<dd><p>Parse the string <var>str</var> as a Maxima expression and evaluate it.
The string <var>str</var> may or may not have a terminator (dollar sign <code>$</code> or semicolon <code>;</code>).
Only the first expression is parsed and evaluated, if there is more than one.
</p>
<p>Complain if <var>str</var> is not a string.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) eval_string (&quot;foo: 42; bar: foo^2 + baz&quot;);
(%o1)                       42
(%i2) eval_string (&quot;(foo: 42, bar: foo^2 + baz)&quot;);
(%o2)                   baz + 1764
</pre>
<p>See also <code>parse_string</code>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="md5sum"></a>
<a name="Item_003a-md5sum"></a>
</p><dl>
<dt><u>Function:</u> <b>md5sum</b><i> (<var>string</var>)</i>
<a name="IDX2755"></a>
</dt>
<dd><p>Returns the md5 checksum of a <var>string</var> as a string. To parse the returned 
value into an integer please set the input base to 16 and prefix the string by zero.
</p>
<p>Example:
</p>
<pre class="example">(%i1) string : md5sum(&quot;foo bar baz&quot;);
(%o1)                  ab07acbb1e496801937adfa772424bf7
(%i2) ibase : obase : 16.$

(%i3) integer : parse_string(sconcat(0, string));
(%o3)                 0ab07acbb1e496801937adfa772424bf7
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-parse_005fstring"></a>
</p><dl>
<dt><u>Function:</u> <b>parse_string</b><i> (<var>str</var>)</i>
<a name="IDX2756"></a>
</dt>
<dd><p>Parse the string <var>str</var> as a Maxima expression (do not evaluate it).
The string <var>str</var> may or may not have a terminator (dollar sign <code>$</code> or semicolon <code>;</code>).
Only the first expression is parsed, if there is more than one.
</p>
<p>Complain if <var>str</var> is not a string.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) parse_string (&quot;foo: 42; bar: foo^2 + baz&quot;);
(%o1)                    foo : 42
(%i2) parse_string (&quot;(foo: 42, bar: foo^2 + baz)&quot;);
                                   2
(%o2)          (foo : 42, bar : foo  + baz)
</pre>
<p>See also <code>eval_string</code>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-scopy"></a>
</p><dl>
<dt><u>Function:</u> <b>scopy</b><i> (<var>string</var>) </i>
<a name="IDX2757"></a>
</dt>
<dd><p>Returns a copy of <var>string</var> as a new string. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sdowncase"></a>
</p><dl>
<dt><u>Function:</u> <b>sdowncase</b><i> (<var>string</var>) </i>
<a name="IDX2758"></a>
</dt>
<dt><u>Function:</u> <b>sdowncase</b><i> (<var>string</var>, <var>start</var>) </i>
<a name="IDX2759"></a>
</dt>
<dt><u>Function:</u> <b>sdowncase</b><i> (<var>string</var>, <var>start</var>, <var>end</var>) </i>
<a name="IDX2760"></a>
</dt>
<dd><p>Like <code>supcase</code>, but uppercase characters are converted to lowercase. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sequal"></a>
</p><dl>
<dt><u>Function:</u> <b>sequal</b><i> (<var>string_1</var>, <var>string_2</var>) </i>
<a name="IDX2761"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>string_1</var> and <var>string_2</var> are the same length and contain the same characters. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sequalignore"></a>
</p><dl>
<dt><u>Function:</u> <b>sequalignore</b><i> (<var>string_1</var>, <var>string_2</var>)</i>
<a name="IDX2762"></a>
</dt>
<dd><p>Like <code>sequal</code> but ignores case. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sexplode"></a>
</p><dl>
<dt><u>Function:</u> <b>sexplode</b><i> (<var>string</var>)</i>
<a name="IDX2763"></a>
</dt>
<dd><p><code>sexplode</code> is an alias for function <code>charlist</code>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-simplode"></a>
</p><dl>
<dt><u>Function:</u> <b>simplode</b><i> (<var>list</var>)  </i>
<a name="IDX2764"></a>
</dt>
<dt><u>Function:</u> <b>simplode</b><i> (<var>list</var>, <var>delim</var>)  </i>
<a name="IDX2765"></a>
</dt>
<dd><p><code>simplode</code> takes a list of expressions and concatenates them into a string.
If no delimiter <var>delim</var> is specified, <code>simplode</code> uses no delimiter.
<var>delim</var> can be any string.
</p>
<pre class="example">(%i1) simplode([&quot;xx[&quot;,3,&quot;]:&quot;,expand((x+y)^3)]);
(%o1)             xx[3]:y^3+3*x*y^2+3*x^2*y+x^3
(%i2) simplode( sexplode(&quot;stars&quot;),&quot; * &quot; );
(%o2)                   s * t * a * r * s
(%i3) simplode( [&quot;One&quot;,&quot;more&quot;,&quot;coffee.&quot;],&quot; &quot; );
(%o3)                   One more coffee.
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sinsert"></a>
</p><dl>
<dt><u>Function:</u> <b>sinsert</b><i> (<var>seq</var>, <var>string</var>, <var>pos</var>)  </i>
<a name="IDX2766"></a>
</dt>
<dd><p>Returns a string that is a concatenation of <code>substring (<var>string</var>, 1, <var>pos</var> - 1)</code>,
the string <var>seq</var> and <code>substring (<var>string</var>, <var>pos</var>)</code>.
Note that the first character in <var>string</var> is in position 1.
</p>
<pre class="example">(%i1) s: &quot;A submarine.&quot;$
(%i2) concat( substring(s,1,3),&quot;yellow &quot;,substring(s,3) );
(%o2)                  A yellow submarine.
(%i3) sinsert(&quot;hollow &quot;,s,3);
(%o3)                  A hollow submarine.
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sinvertcase"></a>
</p><dl>
<dt><u>Function:</u> <b>sinvertcase</b><i> (<var>string</var>)  </i>
<a name="IDX2767"></a>
</dt>
<dt><u>Function:</u> <b>sinvertcase</b><i> (<var>string</var>, <var>start</var>)  </i>
<a name="IDX2768"></a>
</dt>
<dt><u>Function:</u> <b>sinvertcase</b><i> (<var>string</var>, <var>start</var>, <var>end</var>)  </i>
<a name="IDX2769"></a>
</dt>
<dd><p>Returns <var>string</var> except that each character from position <var>start</var> to <var>end</var> is inverted.
If <var>end</var> is not given,
all characters from <var>start</var> to the end of <var>string</var> are replaced.
</p>
<pre class="example">(%i1) sinvertcase(&quot;sInvertCase&quot;);
(%o1)                      SiNVERTcASE
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-slength"></a>
</p><dl>
<dt><u>Function:</u> <b>slength</b><i> (<var>string</var>) </i>
<a name="IDX2770"></a>
</dt>
<dd><p>Returns the number of characters in <var>string</var>. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-smake"></a>
</p><dl>
<dt><u>Function:</u> <b>smake</b><i> (<var>num</var>, <var>char</var>) </i>
<a name="IDX2771"></a>
</dt>
<dd><p>Returns a new string with a number of <var>num</var> characters <var>char</var>. 
</p>
<pre class="example">(%i1) smake(3,&quot;w&quot;);
(%o1)                          www
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-smismatch"></a>
</p><dl>
<dt><u>Function:</u> <b>smismatch</b><i> (<var>string_1</var>, <var>string_2</var>) </i>
<a name="IDX2772"></a>
</dt>
<dt><u>Function:</u> <b>smismatch</b><i> (<var>string_1</var>, <var>string_2</var>, <var>test</var>) </i>
<a name="IDX2773"></a>
</dt>
<dd><p>Returns the position of the first character of <var>string_1</var> at which <var>string_1</var> and <var>string_2</var> differ or <code>false</code>.
Default test function for matching is <code>sequal</code>.
If <code>smismatch</code> should ignore case, use <code>sequalignore</code> as test.
</p>
<pre class="example">(%i1) smismatch(&quot;seven&quot;,&quot;seventh&quot;);
(%o1)                           6
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-split"></a>
</p><dl>
<dt><u>Function:</u> <b>split</b><i> (<var>string</var>)  </i>
<a name="IDX2774"></a>
</dt>
<dt><u>Function:</u> <b>split</b><i> (<var>string</var>, <var>delim</var>)  </i>
<a name="IDX2775"></a>
</dt>
<dt><u>Function:</u> <b>split</b><i> (<var>string</var>, <var>delim</var>, <var>multiple</var>)  </i>
<a name="IDX2776"></a>
</dt>
<dd><p>Returns the list of all tokens in <var>string</var>.
Each token is an unparsed string.
<code>split</code> uses <var>delim</var> as delimiter.
If <var>delim</var> is not given, the space character is the default delimiter.
<var>multiple</var> is a boolean variable with <code>true</code> by default.
Multiple delimiters are read as one.
This is useful if tabs are saved as multiple space characters.
If <var>multiple</var> is set to <code>false</code>, each delimiter is noted.
</p>
<pre class="example">(%i1) split(&quot;1.2   2.3   3.4   4.5&quot;);
(%o1)                 [1.2, 2.3, 3.4, 4.5]
(%i2) split(&quot;first;;third;fourth&quot;,&quot;;&quot;,false);
(%o2)               [first, , third, fourth]
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sposition"></a>
</p><dl>
<dt><u>Function:</u> <b>sposition</b><i> (<var>char</var>, <var>string</var>) </i>
<a name="IDX2777"></a>
</dt>
<dd><p>Returns the position of the first character in <var>string</var> which matches <var>char</var>.
The first character in <var>string</var> is in position 1.
For matching characters ignoring case see <code>ssearch</code>.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sremove"></a>
</p><dl>
<dt><u>Function:</u> <b>sremove</b><i> (<var>seq</var>, <var>string</var>)  </i>
<a name="IDX2778"></a>
</dt>
<dt><u>Function:</u> <b>sremove</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>)  </i>
<a name="IDX2779"></a>
</dt>
<dt><u>Function:</u> <b>sremove</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>)  </i>
<a name="IDX2780"></a>
</dt>
<dt><u>Function:</u> <b>sremove</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>, <var>end</var>)  </i>
<a name="IDX2781"></a>
</dt>
<dd><p>Returns a string like <var>string</var> but without all substrings matching <var>seq</var>.
Default test function for matching is <code>sequal</code>.
If <code>sremove</code> should ignore case while searching for <var>seq</var>, use <code>sequalignore</code> as test.
Use <var>start</var> and <var>end</var> to limit searching.
Note that the first character in <var>string</var> is in position 1.
</p>
<pre class="example">(%i1) sremove(&quot;n't&quot;,&quot;I don't like coffee.&quot;);
(%o1)                   I do like coffee.
(%i2) sremove (&quot;DO &quot;,%,'sequalignore);
(%o2)                    I like coffee.
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sremovefirst"></a>
</p><dl>
<dt><u>Function:</u> <b>sremovefirst</b><i> (<var>seq</var>, <var>string</var>)  </i>
<a name="IDX2782"></a>
</dt>
<dt><u>Function:</u> <b>sremovefirst</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>)  </i>
<a name="IDX2783"></a>
</dt>
<dt><u>Function:</u> <b>sremovefirst</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>)  </i>
<a name="IDX2784"></a>
</dt>
<dt><u>Function:</u> <b>sremovefirst</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>, <var>end</var>)  </i>
<a name="IDX2785"></a>
</dt>
<dd><p>Like <code>sremove</code> except that only the first substring that matches <code>seq</code> is removed. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-sreverse"></a>
</p><dl>
<dt><u>Function:</u> <b>sreverse</b><i> (<var>string</var>) </i>
<a name="IDX2786"></a>
</dt>
<dd><p>Returns a string with all the characters of <var>string</var> in reverse order. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-ssearch"></a>
</p><dl>
<dt><u>Function:</u> <b>ssearch</b><i> (<var>seq</var>, <var>string</var>)  </i>
<a name="IDX2787"></a>
</dt>
<dt><u>Function:</u> <b>ssearch</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>)  </i>
<a name="IDX2788"></a>
</dt>
<dt><u>Function:</u> <b>ssearch</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>)  </i>
<a name="IDX2789"></a>
</dt>
<dt><u>Function:</u> <b>ssearch</b><i> (<var>seq</var>, <var>string</var>, <var>test</var>, <var>start</var>, <var>end</var>)</i>
<a name="IDX2790"></a>
</dt>
<dd><p>Returns the position of the first substring of <var>string</var> that matches the string <var>seq</var>.
Default test function for matching is <code>sequal</code>.
If <code>ssearch</code> should ignore case, use <code>sequalignore</code> as test.
Use <var>start</var> and <var>end</var> to limit searching.
Note that the first character in <var>string</var> is in position 1.
</p>
<pre class="example">(%i1) ssearch(&quot;~s&quot;,&quot;~{~S ~}~%&quot;,'sequalignore);
(%o1)                                  4
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-ssort"></a>
</p><dl>
<dt><u>Function:</u> <b>ssort</b><i> (<var>string</var>) </i>
<a name="IDX2791"></a>
</dt>
<dt><u>Function:</u> <b>ssort</b><i> (<var>string</var>, <var>test</var>) </i>
<a name="IDX2792"></a>
</dt>
<dd><p>Returns a string that contains all characters from <var>string</var> in an order such there are no two successive characters <var>c</var> and <var>d</var> such that <code>test (<var>c</var>, <var>d</var>)</code> is <code>false</code> and <code>test (<var>d</var>, <var>c</var>)</code> is <code>true</code>.
Default test function for sorting is <var>clessp</var>.
The set of test functions is <code>{clessp, clesspignore, cgreaterp, cgreaterpignore, cequal, cequalignore}</code>.
</p>
<pre class="example">(%i1) ssort(&quot;I don't like Mondays.&quot;);
(%o1)                    '.IMaddeiklnnoosty
(%i2) ssort(&quot;I don't like Mondays.&quot;,'cgreaterpignore);
(%o2)                 ytsoonnMlkIiedda.'   
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-ssubst"></a>
</p><dl>
<dt><u>Function:</u> <b>ssubst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>) </i>
<a name="IDX2793"></a>
</dt>
<dt><u>Function:</u> <b>ssubst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>) </i>
<a name="IDX2794"></a>
</dt>
<dt><u>Function:</u> <b>ssubst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>, <var>start</var>) </i>
<a name="IDX2795"></a>
</dt>
<dt><u>Function:</u> <b>ssubst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>, <var>start</var>, <var>end</var>) </i>
<a name="IDX2796"></a>
</dt>
<dd><p>Returns a string like <var>string</var> except that all substrings matching <var>old</var> are replaced by <var>new</var>.
<var>old</var> and <var>new</var> need not to be of the same length.
Default test function for matching is <code>sequal</code>.
If <code>ssubst</code> should ignore case while searching for old, use <code>sequalignore</code> as test.
Use <var>start</var> and <var>end</var> to limit searching.
Note that the first character in <var>string</var> is in position 1.
</p>
<pre class="example">(%i1) ssubst(&quot;like&quot;,&quot;hate&quot;,&quot;I hate Thai food. I hate green tea.&quot;);
(%o1)          I like Thai food. I like green tea.
(%i2) ssubst(&quot;Indian&quot;,&quot;thai&quot;,%,'sequalignore,8,12);
(%o2)         I like Indian food. I like green tea.
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-ssubstfirst"></a>
</p><dl>
<dt><u>Function:</u> <b>ssubstfirst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>) </i>
<a name="IDX2797"></a>
</dt>
<dt><u>Function:</u> <b>ssubstfirst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>) </i>
<a name="IDX2798"></a>
</dt>
<dt><u>Function:</u> <b>ssubstfirst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>, <var>start</var>) </i>
<a name="IDX2799"></a>
</dt>
<dt><u>Function:</u> <b>ssubstfirst</b><i> (<var>new</var>, <var>old</var>, <var>string</var>, <var>test</var>, <var>start</var>, <var>end</var>) </i>
<a name="IDX2800"></a>
</dt>
<dd><p>Like <code>subst</code> except that only the first substring that matches <var>old</var> is replaced. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-strim"></a>
</p><dl>
<dt><u>Function:</u> <b>strim</b><i> (<var>seq</var>,<var>string</var>) </i>
<a name="IDX2801"></a>
</dt>
<dd><p>Returns a string like <var>string</var>,
but with all characters that appear in <var>seq</var> removed from both ends. 
</p>
<pre class="example">(%i1) &quot;/* comment */&quot;$
(%i2) strim(&quot; /*&quot;,%);
(%o2)                        comment
(%i3) slength(%);
(%o3)                           7
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-striml"></a>
</p><dl>
<dt><u>Function:</u> <b>striml</b><i> (<var>seq</var>, <var>string</var>) </i>
<a name="IDX2802"></a>
</dt>
<dd><p>Like <code>strim</code> except that only the left end of <var>string</var> is trimmed. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-strimr"></a>
</p><dl>
<dt><u>Function:</u> <b>strimr</b><i> (<var>seq</var>, <var>string</var>) </i>
<a name="IDX2803"></a>
</dt>
<dd><p>Like <code>strim</code> except that only the right end of string is trimmed. 
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-stringp"></a>
</p><dl>
<dt><u>Function:</u> <b>stringp</b><i> (<var>obj</var>) </i>
<a name="IDX2804"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>obj</var> is a string.
See introduction for example.
</p>
<div class=categorybox>
&middot;
<p>@ref{Category: Predicate functions} &middot;
@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-substring"></a>
</p><dl>
<dt><u>Function:</u> <b>substring</b><i> (<var>string</var>, <var>start</var>)</i>
<a name="IDX2805"></a>
</dt>
<dt><u>Function:</u> <b>substring</b><i> (<var>string</var>, <var>start</var>, <var>end</var>) </i>
<a name="IDX2806"></a>
</dt>
<dd><p>Returns the substring of <var>string</var> beginning at position <var>start</var> and ending at position <var>end</var>.
The character at position <var>end</var> is not included.
If <var>end</var> is not given, the substring contains the rest of the string.
Note that the first character in <var>string</var> is in position 1.
</p>
<pre class="example">(%i1) substring(&quot;substring&quot;,4);
(%o1)                        string
(%i2) substring(%,4,6);
(%o2)                          in
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-supcase"></a>
</p><dl>
<dt><u>Function:</u> <b>supcase</b><i> (<var>string</var>) </i>
<a name="IDX2807"></a>
</dt>
<dt><u>Function:</u> <b>supcase</b><i> (<var>string</var>, <var>start</var>) </i>
<a name="IDX2808"></a>
</dt>
<dt><u>Function:</u> <b>supcase</b><i> (<var>string</var>, <var>start</var>, <var>end</var>) </i>
<a name="IDX2809"></a>
</dt>
<dd><p>Returns <var>string</var> except that lowercase characters from position <var>start</var> to <var>end</var> are replaced by the corresponding uppercase ones.
If <var>end</var> is not given,
all lowercase characters from <var>start</var> to the end of <var>string</var> are replaced.
</p>
<pre class="example">(%i1) supcase(&quot;english&quot;,1,2);
(%o1)                        English
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-tokens"></a>
</p><dl>
<dt><u>Function:</u> <b>tokens</b><i> (<var>string</var>) </i>
<a name="IDX2810"></a>
</dt>
<dt><u>Function:</u> <b>tokens</b><i> (<var>string</var>, <var>test</var>) </i>
<a name="IDX2811"></a>
</dt>
<dd><p>Returns a list of tokens, which have been extracted from <var>string</var>.
The tokens are substrings whose characters satisfy a certain test function.
If test is not given, <var>constituent</var> is used as the default test.
<code>{constituent, alphacharp, digitcharp, lowercasep, uppercasep, charp, characterp, alphanumericp}</code> is the set of test functions. 
(The Lisp-version of <code>tokens</code> is written by Paul Graham. ANSI Common Lisp, 1996, page 67.)
</p>
<pre class="example">(%i1) tokens(&quot;24 October 2005&quot;);
(%o1)                  [24, October, 2005]
(%i2) tokens(&quot;05-10-24&quot;,'digitcharp);
(%o2)                     [05, 10, 24]
(%i3) map(parse_string,%);
(%o3)                      [5, 10, 24]
</pre>
<div class=categorybox>
&middot;
<p>@ref{Category: Package stringproc}
</div>
</p>
</dd></dl>

<p><a name="Item_003a-to_005fpoly_005fsolve"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC361" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_78.html#SEC366" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

</p>
</body>
</html>