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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qstring.cpp:1228 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQString Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQString Class Reference</h1>
<p>The TQString class provides an abstraction of Unicode text
and the classic C '\0'-terminated char array.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include <<a href="qstring-h.html">ntqstring.h</a>></tt>
<p><a href="qstring-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQString"><b>TQString</b></a> ()</li>
<li class=fn><a href="#TQString-2"><b>TQString</b></a> ( TQChar ch )</li>
<li class=fn><a href="#TQString-3"><b>TQString</b></a> ( const TQString & s )</li>
<li class=fn><a href="#TQString-4"><b>TQString</b></a> ( const TQByteArray & ba )</li>
<li class=fn><a href="#TQString-5"><b>TQString</b></a> ( const TQChar * unicode, uint length )</li>
<li class=fn><a href="#TQString-6"><b>TQString</b></a> ( const char * str )</li>
<li class=fn><a href="#TQString-7"><b>TQString</b></a> ( const std::string & str )</li>
<li class=fn><a href="#~TQString"><b>~TQString</b></a> ()</li>
<li class=fn>TQString & <a href="#operator-eq-2"><b>operator=</b></a> ( const TQString & s )</li>
<li class=fn>TQString & <a href="#operator-eq-3"><b>operator=</b></a> ( const char * str )</li>
<li class=fn>TQString & <a href="#operator-eq-4"><b>operator=</b></a> ( const std::string & s )</li>
<li class=fn>TQString & <a href="#operator-eq-5"><b>operator=</b></a> ( const TQCString & cstr )</li>
<li class=fn>TQString & <a href="#operator-eq"><b>operator=</b></a> ( TQChar c )</li>
<li class=fn>TQString & <a href="#operator-eq-6"><b>operator=</b></a> ( char c )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>uint <a href="#length"><b>length</b></a> () const</li>
<li class=fn>void <a href="#truncate"><b>truncate</b></a> ( uint newLen )</li>
<li class=fn>TQString & <a href="#fill"><b>fill</b></a> ( TQChar c, int len = -1 )</li>
<li class=fn>TQString copy () const <em>(obsolete)</em></li>
<li class=fn>TQString <a href="#arg-2"><b>arg</b></a> ( long a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-3"><b>arg</b></a> ( ulong a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-4"><b>arg</b></a> ( TQ_LLONG a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-5"><b>arg</b></a> ( TQ_ULLONG a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-6"><b>arg</b></a> ( int a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-7"><b>arg</b></a> ( uint a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-8"><b>arg</b></a> ( short a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-9"><b>arg</b></a> ( ushort a, int fieldWidth = 0, int base = 10 ) const</li>
<li class=fn>TQString <a href="#arg-a"><b>arg</b></a> ( double a, int fieldWidth = 0, char fmt = 'g', int prec = -1 ) const</li>
<li class=fn>TQString <a href="#arg-b"><b>arg</b></a> ( char a, int fieldWidth = 0 ) const</li>
<li class=fn>TQString <a href="#arg-c"><b>arg</b></a> ( TQChar a, int fieldWidth = 0 ) const</li>
<li class=fn>TQString <a href="#arg"><b>arg</b></a> ( const TQString & a, int fieldWidth = 0 ) const</li>
<li class=fn>TQString <a href="#arg-d"><b>arg</b></a> ( const TQString & a1, const TQString & a2 ) const</li>
<li class=fn>TQString <a href="#arg-e"><b>arg</b></a> ( const TQString & a1, const TQString & a2, const TQString & a3 ) const</li>
<li class=fn>TQString <a href="#arg-f"><b>arg</b></a> ( const TQString & a1, const TQString & a2, const TQString & a3, const TQString & a4 ) const</li>
<li class=fn>TQString & <a href="#sprintf"><b>sprintf</b></a> ( const char * cformat, ... )</li>
<li class=fn>int <a href="#find-2"><b>find</b></a> ( TQChar c, int index = 0, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#find-3"><b>find</b></a> ( char c, int index = 0, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#find-4"><b>find</b></a> ( const TQString & str, int index = 0, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#find"><b>find</b></a> ( const TQRegExp & rx, int index = 0 ) const</li>
<li class=fn>int <a href="#find-5"><b>find</b></a> ( const char * str, int index = 0 ) const</li>
<li class=fn>int <a href="#findRev-2"><b>findRev</b></a> ( TQChar c, int index = -1, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#findRev-3"><b>findRev</b></a> ( char c, int index = -1, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#findRev-4"><b>findRev</b></a> ( const TQString & str, int index = -1, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#findRev-5"><b>findRev</b></a> ( const TQRegExp & rx, int index = -1 ) const</li>
<li class=fn>int <a href="#findRev"><b>findRev</b></a> ( const char * str, int index = -1 ) const</li>
<li class=fn>int <a href="#contains"><b>contains</b></a> ( TQChar c, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#contains-2"><b>contains</b></a> ( char c, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#contains-3"><b>contains</b></a> ( const char * str, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#contains-4"><b>contains</b></a> ( const TQString & str, bool cs = TRUE ) const</li>
<li class=fn>int <a href="#contains-5"><b>contains</b></a> ( const TQRegExp & rx ) const</li>
<li class=fn>enum <a href="#SectionFlags-enum"><b>SectionFlags</b></a> { SectionDefault = 0x00, SectionSkipEmpty = 0x01, SectionIncludeLeadingSep = 0x02, SectionIncludeTrailingSep = 0x04, SectionCaseInsensitiveSeps = 0x08 }</li>
<li class=fn>TQString <a href="#section"><b>section</b></a> ( TQChar sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const</li>
<li class=fn>TQString <a href="#section-2"><b>section</b></a> ( char sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const</li>
<li class=fn>TQString <a href="#section-3"><b>section</b></a> ( const char * sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const</li>
<li class=fn>TQString <a href="#section-4"><b>section</b></a> ( const TQString & sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const</li>
<li class=fn>TQString <a href="#section-5"><b>section</b></a> ( const TQRegExp & reg, int start, int end = 0xffffffff, int flags = SectionDefault ) const</li>
<li class=fn>TQString <a href="#left"><b>left</b></a> ( uint len ) const</li>
<li class=fn>TQString <a href="#right"><b>right</b></a> ( uint len ) const</li>
<li class=fn>TQString <a href="#mid"><b>mid</b></a> ( uint index, uint len = 0xffffffff ) const</li>
<li class=fn>TQString <a href="#leftJustify"><b>leftJustify</b></a> ( uint width, TQChar fill = ' ', bool truncate = FALSE ) const</li>
<li class=fn>TQString <a href="#rightJustify"><b>rightJustify</b></a> ( uint width, TQChar fill = ' ', bool truncate = FALSE ) const</li>
<li class=fn>TQString <a href="#lower"><b>lower</b></a> () const</li>
<li class=fn>TQString <a href="#upper"><b>upper</b></a> () const</li>
<li class=fn>TQString <a href="#stripWhiteSpace"><b>stripWhiteSpace</b></a> () const</li>
<li class=fn>TQString <a href="#simplifyWhiteSpace"><b>simplifyWhiteSpace</b></a> () const</li>
<li class=fn>TQString & <a href="#insert"><b>insert</b></a> ( uint index, const TQString & s )</li>
<li class=fn>TQString & <a href="#insert-2"><b>insert</b></a> ( uint index, const TQByteArray & s )</li>
<li class=fn>TQString & <a href="#insert-3"><b>insert</b></a> ( uint index, const char * s )</li>
<li class=fn>TQString & <a href="#insert-4"><b>insert</b></a> ( uint index, const TQChar * s, uint len )</li>
<li class=fn>TQString & <a href="#insert-5"><b>insert</b></a> ( uint index, TQChar c )</li>
<li class=fn>TQString & <a href="#insert-6"><b>insert</b></a> ( uint index, char c )</li>
<li class=fn>TQString & <a href="#append-2"><b>append</b></a> ( char ch )</li>
<li class=fn>TQString & <a href="#append-3"><b>append</b></a> ( TQChar ch )</li>
<li class=fn>TQString & <a href="#append"><b>append</b></a> ( const TQString & str )</li>
<li class=fn>TQString & <a href="#append-4"><b>append</b></a> ( const TQByteArray & str )</li>
<li class=fn>TQString & <a href="#append-5"><b>append</b></a> ( const char * str )</li>
<li class=fn>TQString & <a href="#append-6"><b>append</b></a> ( const std::string & str )</li>
<li class=fn>TQString & <a href="#prepend-2"><b>prepend</b></a> ( char ch )</li>
<li class=fn>TQString & <a href="#prepend-3"><b>prepend</b></a> ( TQChar ch )</li>
<li class=fn>TQString & <a href="#prepend"><b>prepend</b></a> ( const TQString & s )</li>
<li class=fn>TQString & <a href="#prepend-4"><b>prepend</b></a> ( const TQByteArray & s )</li>
<li class=fn>TQString & <a href="#prepend-5"><b>prepend</b></a> ( const char * s )</li>
<li class=fn>TQString & <a href="#prepend-6"><b>prepend</b></a> ( const std::string & s )</li>
<li class=fn>TQString & <a href="#remove"><b>remove</b></a> ( uint index, uint len )</li>
<li class=fn>TQString & <a href="#remove-2"><b>remove</b></a> ( const TQString & str, bool cs = TRUE )</li>
<li class=fn>TQString & <a href="#remove-3"><b>remove</b></a> ( TQChar c )</li>
<li class=fn>TQString & <a href="#remove-4"><b>remove</b></a> ( char c )</li>
<li class=fn>TQString & <a href="#remove-5"><b>remove</b></a> ( const char * str )</li>
<li class=fn>TQString & <a href="#remove-6"><b>remove</b></a> ( const TQRegExp & rx )</li>
<li class=fn>TQString & <a href="#replace"><b>replace</b></a> ( uint index, uint len, const TQString & s )</li>
<li class=fn>TQString & <a href="#replace-2"><b>replace</b></a> ( uint index, uint len, const TQChar * s, uint slen )</li>
<li class=fn>TQString & <a href="#replace-3"><b>replace</b></a> ( uint index, uint len, TQChar c )</li>
<li class=fn>TQString & <a href="#replace-4"><b>replace</b></a> ( uint index, uint len, char c )</li>
<li class=fn>TQString & <a href="#replace-5"><b>replace</b></a> ( TQChar c, const TQString & after, bool cs = TRUE )</li>
<li class=fn>TQString & <a href="#replace-6"><b>replace</b></a> ( char c, const TQString & after, bool cs = TRUE )</li>
<li class=fn>TQString & <a href="#replace-7"><b>replace</b></a> ( const TQString & before, const TQString & after, bool cs = TRUE )</li>
<li class=fn>TQString & <a href="#replace-8"><b>replace</b></a> ( const TQRegExp & rx, const TQString & after )</li>
<li class=fn>TQString & <a href="#replace-9"><b>replace</b></a> ( TQChar c1, TQChar c2 )</li>
<li class=fn>short <a href="#toShort"><b>toShort</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>ushort <a href="#toUShort"><b>toUShort</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>int <a href="#toInt"><b>toInt</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>uint <a href="#toUInt"><b>toUInt</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>long <a href="#toLong"><b>toLong</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>ulong <a href="#toULong"><b>toULong</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>TQ_LLONG <a href="#toLongLong"><b>toLongLong</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>TQ_ULLONG <a href="#toULongLong"><b>toULongLong</b></a> ( bool * ok = 0, int base = 10 ) const</li>
<li class=fn>float <a href="#toFloat"><b>toFloat</b></a> ( bool * ok = 0 ) const</li>
<li class=fn>double <a href="#toDouble"><b>toDouble</b></a> ( bool * ok = 0 ) const</li>
<li class=fn>TQString & <a href="#setNum-2"><b>setNum</b></a> ( short n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-3"><b>setNum</b></a> ( ushort n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-4"><b>setNum</b></a> ( int n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-5"><b>setNum</b></a> ( uint n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-6"><b>setNum</b></a> ( long n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-7"><b>setNum</b></a> ( ulong n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum"><b>setNum</b></a> ( TQ_LLONG n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-8"><b>setNum</b></a> ( TQ_ULLONG n, int base = 10 )</li>
<li class=fn>TQString & <a href="#setNum-9"><b>setNum</b></a> ( float n, char f = 'g', int prec = 6 )</li>
<li class=fn>TQString & <a href="#setNum-a"><b>setNum</b></a> ( double n, char f = 'g', int prec = 6 )</li>
<li class=fn>void setExpand ( uint index, TQChar c ) <em>(obsolete)</em></li>
<li class=fn>TQString & <a href="#operator+-eq"><b>operator+=</b></a> ( const TQString & str )</li>
<li class=fn>TQString & <a href="#operator+-eq-2"><b>operator+=</b></a> ( const TQByteArray & str )</li>
<li class=fn>TQString & <a href="#operator+-eq-3"><b>operator+=</b></a> ( const char * str )</li>
<li class=fn>TQString & <a href="#operator+-eq-4"><b>operator+=</b></a> ( const std::string & str )</li>
<li class=fn>TQString & <a href="#operator+-eq-5"><b>operator+=</b></a> ( TQChar c )</li>
<li class=fn>TQString & <a href="#operator+-eq-6"><b>operator+=</b></a> ( char c )</li>
<li class=fn>TQChar <a href="#at"><b>at</b></a> ( uint i ) const</li>
<li class=fn>TQChar <a href="#operator[]"><b>operator[]</b></a> ( int i ) const</li>
<li class=fn>TQCharRef <a href="#at-2"><b>at</b></a> ( uint i )</li>
<li class=fn>TQCharRef <a href="#operator[]-2"><b>operator[]</b></a> ( int i )</li>
<li class=fn>TQChar <a href="#constref"><b>constref</b></a> ( uint i ) const</li>
<li class=fn>TQChar & <a href="#ref"><b>ref</b></a> ( uint i )</li>
<li class=fn>const TQChar * <a href="#unicode"><b>unicode</b></a> () const</li>
<li class=fn>const char * <a href="#ascii"><b>ascii</b></a> () const</li>
<li class=fn>const char * <a href="#latin1"><b>latin1</b></a> () const</li>
<li class=fn>TQCString <a href="#utf8"><b>utf8</b></a> () const</li>
<li class=fn>TQCString <a href="#local8Bit"><b>local8Bit</b></a> () const</li>
<li class=fn>bool <a href="#operator!"><b>operator!</b></a> () const</li>
<li class=fn><a href="#operator-const-char-*"><b>operator const char *</b></a> () const</li>
<li class=fn><a href="#operator-std::string"><b>operator std::string</b></a> () const</li>
<li class=fn>const unsigned short * <a href="#ucs2"><b>ucs2</b></a> () const</li>
<li class=fn>TQString & <a href="#setUnicode"><b>setUnicode</b></a> ( const TQChar * unicode, uint len )</li>
<li class=fn>TQString & <a href="#setUnicodeCodes"><b>setUnicodeCodes</b></a> ( const ushort * unicode_as_ushorts, uint len )</li>
<li class=fn>TQString & <a href="#setAscii"><b>setAscii</b></a> ( const char * str, int len = -1 )</li>
<li class=fn>TQString & <a href="#setLatin1"><b>setLatin1</b></a> ( const char * str, int len = -1 )</li>
<li class=fn>int <a href="#compare-2"><b>compare</b></a> ( const TQString & s ) const</li>
<li class=fn>int <a href="#localeAwareCompare-2"><b>localeAwareCompare</b></a> ( const TQString & s ) const</li>
<li class=fn>void <a href="#compose"><b>compose</b></a> ()</li>
<li class=fn>const char * data () const <em>(obsolete)</em></li>
<li class=fn>bool <a href="#startsWith"><b>startsWith</b></a> ( const TQString & s, bool cs = TRUE ) const</li>
<li class=fn>bool <a href="#endsWith"><b>endsWith</b></a> ( const TQString & s, bool cs = TRUE ) const</li>
<li class=fn>void <a href="#setLength"><b>setLength</b></a> ( uint newLen )</li>
<li class=fn>uint <a href="#capacity"><b>capacity</b></a> () const</li>
<li class=fn>void <a href="#reserve"><b>reserve</b></a> ( uint minCapacity )</li>
<li class=fn>void <a href="#squeeze"><b>squeeze</b></a> ()</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQString <a href="#number"><b>number</b></a> ( long n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-2"><b>number</b></a> ( ulong n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-3"><b>number</b></a> ( TQ_LLONG n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-4"><b>number</b></a> ( TQ_ULLONG n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-5"><b>number</b></a> ( int n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-6"><b>number</b></a> ( uint n, int base = 10 )</li>
<li class=fn>TQString <a href="#number-7"><b>number</b></a> ( double n, char f = 'g', int prec = 6 )</li>
<li class=fn>TQString <a href="#fromAscii"><b>fromAscii</b></a> ( const char * ascii, int len = -1 )</li>
<li class=fn>TQString <a href="#fromLatin1"><b>fromLatin1</b></a> ( const char * chars, int len = -1 )</li>
<li class=fn>TQString <a href="#fromUtf8"><b>fromUtf8</b></a> ( const char * utf8, int len = -1 )</li>
<li class=fn>TQString <a href="#fromLocal8Bit"><b>fromLocal8Bit</b></a> ( const char * local8Bit, int len = -1 )</li>
<li class=fn>TQString <a href="#fromUcs2"><b>fromUcs2</b></a> ( const unsigned short * str )</li>
<li class=fn>int <a href="#compare"><b>compare</b></a> ( const TQString & s1, const TQString & s2 )</li>
<li class=fn>int <a href="#localeAwareCompare"><b>localeAwareCompare</b></a> ( const TQString & s1, const TQString & s2 )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQString & s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator-eq-eq-3"><b>operator==</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQString & s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator!-eq-2"><b>operator!=</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator!-eq-3"><b>operator!=</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator-lt-2"><b>operator<</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator-lt-eq-2"><b>operator<=</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator-gt-2"><b>operator></b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>bool <a href="#operator-gt-eq-2"><b>operator>=</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>const TQString <a href="#operator+"><b>operator+</b></a> ( const TQString & s1, const TQString & s2 )</li>
<li class=fn>const TQString <a href="#operator+-2"><b>operator+</b></a> ( const TQString & s1, const char * s2 )</li>
<li class=fn>const TQString <a href="#operator+-3"><b>operator+</b></a> ( const char * s1, const TQString & s2 )</li>
<li class=fn>const TQString <a href="#operator+-4"><b>operator+</b></a> ( const TQString & s, char c )</li>
<li class=fn>const TQString <a href="#operator+-5"><b>operator+</b></a> ( char c, const TQString & s )</li>
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQString & str )</li>
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQString & str )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQString class provides an abstraction of Unicode text
and the classic C '\0'-terminated char array.
<p>
<p> TQString uses <a href="shclass.html">implicit sharing</a>, which
makes it very efficient and easy to use.
<p> In all of the TQString methods that take <tt>const char *</tt>
parameters, the <tt>const char *</tt> is interpreted as a classic
C-style '\0'-terminated ASCII string. It is legal for the <tt>const char *</tt> parameter to be 0. If the <tt>const char *</tt> is not
'\0'-terminated, the results are undefined. Functions that copy
classic C strings into a TQString will not copy the terminating
'\0' character. The <a href="qchar.html">TQChar</a> array of the TQString (as returned by
<a href="#unicode">unicode</a>()) is generally not terminated by a '\0'. If you need to
pass a TQString to a function that requires a C '\0'-terminated
string use <a href="#latin1">latin1</a>().
<p> <!-- index TQString::null --><a name="TQString-null"></a>A TQString that has not been assigned to anything is <em>null</em>, i.e.
both the length and data pointer is 0. A TQString that references
the empty string ("", a single '\0' char) is <em>empty</em>. Both null
and empty TQStrings are legal parameters to the methods. Assigning
<tt>(const char *) 0</tt> to TQString gives a null TQString. For
convenience, <a href="ntqstring.html#TQString-null">TQString::null</a> is a null TQString. When sorting,
empty strings come first, followed by non-empty strings, followed
by null strings. We recommend using <tt>if ( !str.isNull() )</tt> to
check for a non-null string rather than <tt>if ( !str )</tt>; see <a href="#operator!">operator!</a>() for an explanation.
<p> Note that if you find that you are mixing usage of <a href="ntqcstring.html">TQCString</a>,
TQString, and <a href="qbytearray.html">TQByteArray</a>, this causes lots of unnecessary
copying and might indicate that the true nature of the data you
are dealing with is uncertain. If the data is '\0'-terminated 8-bit
data, use <a href="ntqcstring.html">TQCString</a>; if it is unterminated (i.e. contains '\0's)
8-bit data, use <a href="qbytearray.html">TQByteArray</a>; if it is text, use TQString.
<p> Lists of strings are handled by the <a href="ntqstringlist.html">TQStringList</a> class. You can
split a string into a list of strings using <a href="ntqstringlist.html#split">TQStringList::split</a>(),
and join a list of strings into a single string with an optional
separator using <a href="ntqstringlist.html#join">TQStringList::join</a>(). You can obtain a list of
strings from a string list that contain a particular substring or
that match a particular <a href="ntqregexp.html">regex</a> using
<a href="ntqstringlist.html#grep">TQStringList::grep</a>().
<p> <b>Note for C programmers</b>
<p> Due to C++'s type system and the fact that TQString is <a href="shclass.html#implicitly-shared">implicitly shared</a>, TQStrings can be treated like ints or other simple base
types. For example:
<p> <pre>
TQString boolToString( bool b )
{
TQString result;
if ( b )
result = "True";
else
result = "False";
return result;
}
</pre>
<p> The variable, result, is an auto variable allocated on the stack.
When return is called, because we're returning by value, The copy
constructor is called and a copy of the string is returned. (No
actual copying takes place thanks to the <a href="shclass.html#implicit-sharing">implicit sharing</a>, see
below.)
<p> Throughout TQt's source code you will encounter TQString usages like
this:
<pre>
TQString func( const TQString& input )
{
TQString output = input;
// process output
return output;
}
</pre>
<p> The 'copying' of input to output is almost as fast as copying a
pointer because behind the scenes copying is achieved by
incrementing a reference count. TQString (like all TQt's implicitly
shared classes) operates on a copy-on-write basis, only copying if
an instance is actually changed.
<p> If you wish to create a <a href="shclass.html#deep-copy">deep copy</a> of a TQString without losing any
Unicode information then you should use <a href="ntqdeepcopy.html">TQDeepCopy</a>.
<p> <p>See also <a href="qchar.html">TQChar</a>, <a href="ntqcstring.html">TQCString</a>, <a href="qbytearray.html">TQByteArray</a>, <a href="qconststring.html">TQConstString</a>, <a href="shared.html">Implicitly and Explicitly Shared Classes</a>, <a href="text.html">Text Related Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="SectionFlags-enum"></a>TQString::SectionFlags</h3>
<ul>
<li><tt>TQString::SectionDefault</tt> - Empty fields are counted, leading and
trailing separators are not included, and the separator is
compared case sensitively.
<li><tt>TQString::SectionSkipEmpty</tt> - Treat empty fields as if they don't exist,
i.e. they are not considered as far as <em>start</em> and <em>end</em> are
concerned.
<li><tt>TQString::SectionIncludeLeadingSep</tt> - Include the leading separator (if
any) in the result string.
<li><tt>TQString::SectionIncludeTrailingSep</tt> - Include the trailing separator
(if any) in the result string.
<li><tt>TQString::SectionCaseInsensitiveSeps</tt> - Compare the separator
case-insensitively.
</ul><p> Any of the last four values can be OR-ed together to form a flag.
<p> <p>See also <a href="#section">section</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQString"></a>TQString::TQString ()
</h3>
<p> Constructs a null string, i.e. both the length and data pointer
are 0.
<p> <p>See also <a href="#isNull">isNull</a>().
<h3 class=fn><a name="TQString-2"></a>TQString::TQString ( <a href="qchar.html">TQChar</a> ch )
</h3>
Constructs a string of length one, containing the character <em>ch</em>.
<h3 class=fn><a name="TQString-3"></a>TQString::TQString ( const <a href="ntqstring.html">TQString</a> & s )
</h3>
Constructs an <a href="shclass.html#implicitly-shared">implicitly shared</a> copy of <em>s</em>. This is very fast
since it only involves incrementing a reference count.
<h3 class=fn><a name="TQString-4"></a>TQString::TQString ( const <a href="qbytearray.html">TQByteArray</a> & ba )
</h3>
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>ba</em> interpreted as a
classic C string.
<h3 class=fn><a name="TQString-5"></a>TQString::TQString ( const <a href="qchar.html">TQChar</a> * unicode, uint length )
</h3>
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of the first <em>length</em>
characters in the <a href="qchar.html">TQChar</a> array.
<p> If <em>unicode</em> and <em>length</em> are 0, then a null string is created.
<p> If only <em>unicode</em> is 0, the string is empty but has <em>length</em>
characters of space preallocated: TQString expands automatically
anyway, but this may speed up some cases a little. We recommend
using the plain constructor and <a href="#setLength">setLength</a>() for this purpose since
it will result in more readable code.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#setLength">setLength</a>().
<h3 class=fn><a name="TQString-6"></a>TQString::TQString ( const char * str )
</h3>
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as
a classic C string. The encoding is assumed to be Latin-1, unless
you change it using <a href="ntqtextcodec.html#setCodecForCStrings">TQTextCodec::setCodecForCStrings</a>().
<p> If <em>str</em> is 0, then a null string is created.
<p> This is a cast constructor, but it is perfectly safe: converting a
Latin-1 <tt>const char *</tt> to TQString preserves all the information. You
can disable this constructor by defining <tt>TQT_NO_CAST_ASCII</tt> when
you compile your applications. You can also make TQString objects
by using <a href="#setLatin1">setLatin1</a>(), <a href="#fromLatin1">fromLatin1</a>(), <a href="#fromLocal8Bit">fromLocal8Bit</a>(), and
<a href="#fromUtf8">fromUtf8</a>(). Or whatever encoding is appropriate for the 8-bit data
you have.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#fromAscii">fromAscii</a>().
<h3 class=fn><a name="TQString-7"></a>TQString::TQString ( const std::string & str )
</h3>
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>.
<p> This is the same as <a href="#fromAscii">fromAscii</a>(<em>str</em>).
<h3 class=fn><a name="~TQString"></a>TQString::~TQString ()
</h3>
<p> Destroys the string and frees the string's data if this is the
last reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append"></a>TQString::append ( const <a href="ntqstring.html">TQString</a> & str )
</h3>
<p> Appends <em>str</em> to the string and returns a reference to the
result.
<p> <pre>
string = "Test";
string.append( "ing" ); // string == "Testing"
</pre>
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<p>Example: <a href="dirview-example.html#x1701">dirview/dirview.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append-2"></a>TQString::append ( char ch )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends character <em>ch</em> to the string and returns a reference to
the result.
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append-3"></a>TQString::append ( <a href="qchar.html">TQChar</a> ch )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends character <em>ch</em> to the string and returns a reference to
the result.
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append-4"></a>TQString::append ( const <a href="qbytearray.html">TQByteArray</a> & str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the result.
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append-5"></a>TQString::append ( const char * str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the result.
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="append-6"></a>TQString::append ( const std::string & str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the result.
<p> Equivalent to <a href="#operator+-eq">operator+=</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg"></a>TQString::arg ( const <a href="ntqstring.html">TQString</a> & a, int fieldWidth = 0 ) const
</h3>
This function will return a string that replaces the lowest
numbered occurrence of <tt>%1</tt>, <tt>%2</tt>, ..., <tt>%9</tt> with <em>a</em>.
<p> The <em>fieldWidth</em> value specifies the minimum amount of space that
<em>a</em> is padded to. A positive value will produce right-aligned
text, whereas a negative value will produce left-aligned text.
<p> The following example shows how we could create a 'status' string
when processing a list of files:
<pre>
TQString status = <a href="#TQString">TQString</a>( "Processing file %1 of %2: %3" )
.arg( i ) // current file's number
.arg( total ) // number of files to process
.arg( fileName ); // current file's name
</pre>
<p> It is generally fine to use filenames and numbers as we have done
in the example above. But note that using <a href="#arg">arg</a>() to construct
natural language sentences does not usually translate well into
other languages because sentence structure and word order often
differ between languages.
<p> If there is no place marker (<tt>%1</tt>, <tt>%2</tt>, etc.), a warning
message (<a href="ntqapplication.html#qWarning">tqWarning</a>()) is output and the result is undefined.
<p> <b>Warning:</b> If any placeholder occurs more than once, the result is undefined.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-2"></a>TQString::arg ( long a, int fieldWidth = 0, int base = 10 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> The <em>fieldWidth</em> value specifies the minimum amount of space that
<em>a</em> is padded to. A positive value will produce a right-aligned
number, whereas a negative value will produce a left-aligned
number.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36.
<p> The '%' can be followed by an 'L', in which case the sequence is
replaced with a localized representation of <em>a</em>. The conversion
uses the default locale. The default locale is determined from the
system's locale settings at application startup. It can be changed
using <a href="ntqlocale.html#setDefault">TQLocale::setDefault</a>(). The 'L' flag is ignored if <em>base</em> is
not 10.
<p> <pre>
TQString str;
str = <a href="#TQString">TQString</a>( "Decimal 63 is %1 in hexadecimal" )
.arg( 63, 0, 16 );
// str == "Decimal 63 is 3f in hexadecimal"
TQLocale::<a href="ntqlocale.html#setDefault">setDefault</a>(TQLocale::English, TQLocale::UnitedStates);
str = <a href="#TQString">TQString</a>( "%1 %L2 %L3" )
.arg( 12345 )
.arg( 12345 )
.arg( 12345, 0, 16 );
// str == "12345 12,345 3039"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-3"></a>TQString::arg ( ulong a, int fieldWidth = 0, int base = 10 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-4"></a>TQString::arg ( TQ_LLONG a, int fieldWidth = 0, int base = 10 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-5"></a>TQString::arg ( TQ_ULLONG a, int fieldWidth = 0, int base = 10 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-6"></a>TQString::arg ( int a, int fieldWidth = 0, int base = 10 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-7"></a>TQString::arg ( uint a, int fieldWidth = 0, int base = 10 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-8"></a>TQString::arg ( short a, int fieldWidth = 0, int base = 10 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-9"></a>TQString::arg ( ushort a, int fieldWidth = 0, int base = 10 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is expressed in base <em>base</em>, which is 10 by default and must
be between 2 and 36. If <em>base</em> is 10, the '%L' syntax can be used
to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-a"></a>TQString::arg ( double a, int fieldWidth = 0, char fmt = 'g', int prec = -1 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <a name="arg-formats"></a>
<p> Argument <em>a</em> is formatted according to the <em>fmt</em> format specified,
which is 'g' by default and can be any of the following:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Meaning
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>e</tt> <td valign="top">format as [-]9.9e[+|-]999
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>E</tt> <td valign="top">format as [-]9.9E[+|-]999
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>f</tt> <td valign="top">format as [-]9.9
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>g</tt> <td valign="top">use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>G</tt> <td valign="top">use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise
</table></center>
<p> With 'e', 'E', and 'f', <em>prec</em> is the number of digits after the
decimal point. With 'g' and 'G', <em>prec</em> is the maximum number of
significant digits (trailing zeroes are omitted).
<p> <pre>
double d = 12.34;
TQString ds = <a href="#TQString">TQString</a>( "'E' format, precision 3, gives %1" )
.arg( d, 0, 'E', 3 );
// ds == "'E' format, precision 3, gives 1.234E+01"
</pre>
<p> The '%L' syntax can be used to produce localized strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-b"></a>TQString::arg ( char a, int fieldWidth = 0 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>a</em> is assumed to be in the Latin-1 character set.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-c"></a>TQString::arg ( <a href="qchar.html">TQChar</a> a, int fieldWidth = 0 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-d"></a>TQString::arg ( const <a href="ntqstring.html">TQString</a> & a1, const <a href="ntqstring.html">TQString</a> & a2 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This is the same as str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>), except that
the strings are replaced in one pass. This can make a difference
if <em>a1</em> contains e.g. <tt>%1</tt>:
<p> <pre>
TQString str( "%1 %2" );
str.<a href="#arg">arg</a>( "Hello", "world" ); // returns "Hello world"
str.<a href="#arg">arg</a>( "Hello" ).arg( "world" ); // returns "Hello world"
str.<a href="#arg">arg</a>( "(%1)", "Hello" ); // returns "(%1) Hello"
str.<a href="#arg">arg</a>( "(%1)" ).arg( "Hello" ); // returns "(Hello) %2"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-e"></a>TQString::arg ( const <a href="ntqstring.html">TQString</a> & a1, const <a href="ntqstring.html">TQString</a> & a2, const <a href="ntqstring.html">TQString</a> & a3 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This is the same as calling str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>).arg(<em>a3</em>),
except that the strings are replaced in one pass.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="arg-f"></a>TQString::arg ( const <a href="ntqstring.html">TQString</a> & a1, const <a href="ntqstring.html">TQString</a> & a2, const <a href="ntqstring.html">TQString</a> & a3, const <a href="ntqstring.html">TQString</a> & a4 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This is the same as calling
str.<a href="#arg">arg</a>(<em>a1</em>).arg(<em>a2</em>).arg(<em>a3</em>).arg(<em>a4</em>),
except that the strings are replaced in one pass.
<h3 class=fn>const char * <a name="ascii"></a>TQString::ascii () const
</h3>
Returns an 8-bit ASCII representation of the string.
<p> If a codec has been set using <a href="ntqtextcodec.html#codecForCStrings">TQTextCodec::codecForCStrings</a>(),
it is used to convert Unicode to 8-bit char. Otherwise, this function
does the same as <a href="#latin1">latin1</a>().
<p> <p>See also <a href="#fromAscii">fromAscii</a>(), <a href="#latin1">latin1</a>(), <a href="#utf8">utf8</a>(), and <a href="#local8Bit">local8Bit</a>().
<p>Example: <a href="networkprotocol-example.html#x690">network/networkprotocol/nntp.cpp</a>.
<h3 class=fn><a href="qchar.html">TQChar</a> <a name="at"></a>TQString::at ( uint i ) const
</h3>
<p> Returns the character at index <em>i</em>, or 0 if <em>i</em> is beyond the
length of the string.
<p> <pre>
const TQString string( "abcdefgh" );
<a href="qchar.html">TQChar</a> ch = string.<a href="#at">at</a>( 4 );
// ch == 'e'
</pre>
<p> If the TQString is not const (i.e. const TQString) or const& (i.e.
const TQString &), then the non-const overload of <a href="#at">at</a>() will be used
instead.
<h3 class=fn><a href="qcharref.html">TQCharRef</a> <a name="at-2"></a>TQString::at ( uint i )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> The function returns a reference to the character at index <em>i</em>.
The resulting reference can then be assigned to, or used
immediately, but it will become invalid once further modifications
are made to the original string.
<p> If <em>i</em> is beyond the length of the string then the string is
expanded with TQChar::null.
<h3 class=fn>uint <a name="capacity"></a>TQString::capacity () const
</h3>
<p> Returns the number of characters this string can hold
in the allocated memory.
<p> <p>See also <a href="#reserve">reserve</a>() and <a href="#squeeze">squeeze</a>().
<h3 class=fn>int <a name="compare"></a>TQString::compare ( const <a href="ntqstring.html">TQString</a> & s1, const <a href="ntqstring.html">TQString</a> & s2 )<tt> [static]</tt>
</h3>
<p> Lexically compares <em>s1</em> with <em>s2</em> and returns an integer less
than, equal to, or greater than zero if <em>s1</em> is less than, equal
to, or greater than <em>s2</em>.
<p> The comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would
expect. Consider sorting user-interface strings with
<a href="#localeAwareCompare">TQString::localeAwareCompare</a>().
<p> <pre>
int a = TQString::<a href="#compare">compare</a>( "def", "abc" ); // a > 0
int b = TQString::<a href="#compare">compare</a>( "abc", "def" ); // b < 0
int c = TQString::<a href="#compare">compare</a>( "abc", "abc" ); // c == 0
</pre>
<h3 class=fn>int <a name="compare-2"></a>TQString::compare ( const <a href="ntqstring.html">TQString</a> & s ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Lexically compares this string with <em>s</em> and returns an integer
less than, equal to, or greater than zero if it is less than, equal
to, or greater than <em>s</em>.
<h3 class=fn>void <a name="compose"></a>TQString::compose ()
</h3>
<b>Warning:</b> This function is not supported in TQt 3.x. It is provided
for experimental and illustrative purposes only. It is mainly of
interest to those experimenting with Arabic and other
composition-rich texts.
<p> Applies possible ligatures to a TQString. Useful when
composition-rich text requires rendering with glyph-poor fonts,
but it also makes compositions such as <a href="qchar.html">TQChar</a>(0x0041) ('A') and
TQChar(0x0308) (Unicode accent diaresis), giving TQChar(0x00c4)
(German A Umlaut).
<h3 class=fn><a href="qchar.html">TQChar</a> <a name="constref"></a>TQString::constref ( uint i ) const
</h3>
<p> Returns the <a href="qchar.html">TQChar</a> at index <em>i</em> by value.
<p> Equivalent to <a href="#at">at</a>(<em>i</em>).
<p> <p>See also <a href="#ref">ref</a>().
<h3 class=fn>int <a name="contains"></a>TQString::contains ( <a href="qchar.html">TQChar</a> c, bool cs = TRUE ) const
</h3>
Returns the number of times the character <em>c</em> occurs in the
string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> <pre>
TQString string( "Trolltech and TQt" );
int n = string.<a href="#contains">contains</a>( 't', FALSE );
// n == 3
</pre>
<p>Examples: <a href="fileiconview-example.html#x867">fileiconview/qfileiconview.cpp</a> and <a href="mdi-example.html#x2064">mdi/application.cpp</a>.
<h3 class=fn>int <a name="contains-2"></a>TQString::contains ( char c, bool cs = TRUE ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn>int <a name="contains-3"></a>TQString::contains ( const char * str, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the number of times the string <em>str</em> occurs in the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<h3 class=fn>int <a name="contains-4"></a>TQString::contains ( const <a href="ntqstring.html">TQString</a> & str, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the number of times <em>str</em> occurs in the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> This function counts overlapping strings, so in the example below,
there are two instances of "ana" in "bananas".
<p> <pre>
TQString str( "bananas" );
int i = str.<a href="#contains">contains</a>( "ana" ); // i == 2
</pre>
<p> <p>See also <a href="#findRev">findRev</a>().
<h3 class=fn>int <a name="contains-5"></a>TQString::contains ( const <a href="ntqregexp.html">TQRegExp</a> & rx ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the number of times the regexp, <em>rx</em>, matches in the
string.
<p> This function counts overlapping matches, so in the example below,
there are four instances of "ana" or "ama".
<p> <pre>
TQString str = "banana and panama";
<a href="ntqregexp.html">TQRegExp</a> rxp = TQRegExp( "a[nm]a", TRUE, FALSE );
int i = str.<a href="#contains">contains</a>( rxp ); // i == 4
</pre>
<p> <p>See also <a href="#find">find</a>() and <a href="#findRev">findRev</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="copy"></a>TQString::copy () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> In TQt 2.0 and later, all calls to this function are needless. Just
remove them.
<h3 class=fn>const char * <a name="data"></a>TQString::data () const
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns a pointer to a '\0'-terminated classic C string.
<p> In TQt 1.x, this returned a char* allowing direct manipulation of the
string as a sequence of bytes. In TQt 2.x where TQString is a Unicode
string, char* conversion constructs a temporary string, and hence
direct character operations are meaningless.
<h3 class=fn>bool <a name="endsWith"></a>TQString::endsWith ( const <a href="ntqstring.html">TQString</a> & s, bool cs = TRUE ) const
</h3>
Returns TRUE if the string ends with <em>s</em>; otherwise returns
FALSE.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> <pre>
TQString str( "Bananas" );
str.<a href="#endsWith">endsWith</a>( "anas" ); // returns TRUE
str.<a href="#endsWith">endsWith</a>( "pple" ); // returns FALSE
</pre>
<p> <p>See also <a href="#startsWith">startsWith</a>().
<p>Example: <a href="tutorial2-04.html#x2561">chart/main.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="fill"></a>TQString::fill ( <a href="qchar.html">TQChar</a> c, int len = -1 )
</h3>
Fills the string with <em>len</em> characters of value <em>c</em>, and returns
a reference to the string.
<p> If <em>len</em> is negative (the default), the current string length is
used.
<p> <pre>
TQString str;
str.<a href="#fill">fill</a>( 'g', 5 ); // string == "ggggg"
</pre>
<h3 class=fn>int <a name="find"></a>TQString::find ( const <a href="ntqregexp.html">TQRegExp</a> & rx, int index = 0 ) const
</h3>
Finds the first match of the <a href="ntqregexp.html#regular-expression">regular expression</a> <em>rx</em>, starting
from position <em>index</em>. If <em>index</em> is -1, the search starts at
the last character; if -2, at the next to last character and so
on. (See <a href="#findRev">findRev</a>() for searching backwards.)
<p> Returns the position of the first match of <em>rx</em> or -1 if no match
was found.
<p> <pre>
TQString string( "bananas" );
int i = string.<a href="#find">find</a>( TQRegExp("an"), 0 ); // i == 1
</pre>
<p> <p>See also <a href="#findRev">findRev</a>(), <a href="#replace">replace</a>(), and <a href="#contains">contains</a>().
<p>Example: <a href="mail-example.html#x715">network/mail/smtp.cpp</a>.
<h3 class=fn>int <a name="find-2"></a>TQString::find ( <a href="qchar.html">TQChar</a> c, int index = 0, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Finds the first occurrence of the character <em>c</em>, starting at
position <em>index</em>. If <em>index</em> is -1, the search starts at the
last character; if -2, at the next to last character and so on.
(See <a href="#findRev">findRev</a>() for searching backwards.)
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> Returns the position of <em>c</em> or -1 if <em>c</em> could not be found.
<h3 class=fn>int <a name="find-3"></a>TQString::find ( char c, int index = 0, bool cs = TRUE ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Find character <em>c</em> starting from position <em>index</em>.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<h3 class=fn>int <a name="find-4"></a>TQString::find ( const <a href="ntqstring.html">TQString</a> & str, int index = 0, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Finds the first occurrence of the string <em>str</em>, starting at
position <em>index</em>. If <em>index</em> is -1, the search starts at the
last character, if it is -2, at the next to last character and so
on. (See <a href="#findRev">findRev</a>() for searching backwards.)
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> Returns the position of <em>str</em> or -1 if <em>str</em> could not be found.
<h3 class=fn>int <a name="find-5"></a>TQString::find ( const char * str, int index = 0 ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Equivalent to <a href="#find">find</a>(TQString(<em>str</em>), <em>index</em>).
<h3 class=fn>int <a name="findRev"></a>TQString::findRev ( const char * str, int index = -1 ) const
</h3>
<p> Equivalent to <a href="#findRev">findRev</a>(TQString(<em>str</em>), <em>index</em>).
<h3 class=fn>int <a name="findRev-2"></a>TQString::findRev ( <a href="qchar.html">TQChar</a> c, int index = -1, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Finds the first occurrence of the character <em>c</em>, starting at
position <em>index</em> and searching backwards. If the index is -1, the
search starts at the last character, if it is -2, at the next to
last character and so on.
<p> Returns the position of <em>c</em> or -1 if <em>c</em> could not be found.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> <pre>
TQString string( "bananas" );
int i = string.<a href="#findRev">findRev</a>( 'a' ); // i == 5
</pre>
<h3 class=fn>int <a name="findRev-3"></a>TQString::findRev ( char c, int index = -1, bool cs = TRUE ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Find character <em>c</em> starting from position <em>index</em> and working
backwards.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<h3 class=fn>int <a name="findRev-4"></a>TQString::findRev ( const <a href="ntqstring.html">TQString</a> & str, int index = -1, bool cs = TRUE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Finds the first occurrence of the string <em>str</em>, starting at
position <em>index</em> and searching backwards. If the index is -1, the
search starts at the last character, if it is -2, at the next to
last character and so on.
<p> Returns the position of <em>str</em> or -1 if <em>str</em> could not be found.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> <pre>
TQString string("bananas");
int i = string.<a href="#findRev">findRev</a>( "ana" ); // i == 3
</pre>
<h3 class=fn>int <a name="findRev-5"></a>TQString::findRev ( const <a href="ntqregexp.html">TQRegExp</a> & rx, int index = -1 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Finds the first match of the regexp <em>rx</em>, starting at position <em>index</em> and searching backwards. If the index is -1, the search
starts at the last character, if it is -2, at the next to last
character and so on. (See <a href="#findRev">findRev</a>() for searching backwards.)
<p> Returns the position of the match or -1 if no match was found.
<p> <pre>
TQString string( "bananas" );
int i = string.<a href="#findRev">findRev</a>( TQRegExp("an") ); // i == 3
</pre>
<p> <p>See also <a href="#find">find</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromAscii"></a>TQString::fromAscii ( const char * ascii, int len = -1 )<tt> [static]</tt>
</h3>
Returns the Unicode string decoded from the first <em>len</em>
bytes of <em>ascii</em>, ignoring the rest of <em>ascii</em>. If <em>len</em>
is -1 then the length of <em>ascii</em> is used. If <em>len</em> is bigger
than the length of <em>ascii</em> then it will use the length of <em>ascii</em>.
<p> If a codec has been set using <a href="ntqtextcodec.html#codecForCStrings">TQTextCodec::codecForCStrings</a>(),
it is used to convert the string from 8-bit characters to Unicode.
Otherwise, this function does the same as <a href="#fromLatin1">fromLatin1</a>().
<p> This is the same as the TQString(const char*) constructor, but you
can make that constructor invisible if you compile with the define
<tt>TQT_NO_CAST_ASCII</tt>, in which case you can explicitly create a
TQString from 8-bit ASCII text using this function.
<p> <pre>
TQString str = TQString::<a href="#fromAscii">fromAscii</a>( "123456789", 5 );
// str == "12345"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromLatin1"></a>TQString::fromLatin1 ( const char * chars, int len = -1 )<tt> [static]</tt>
</h3>
Returns the Unicode string decoded from the first <em>len</em>
bytes of <em>chars</em>, ignoring the rest of <em>chars</em>. If <em>len</em>
is -1 then the length of <em>chars</em> is used. If <em>len</em> is bigger
than the length of <em>chars</em> then it will use the length of <em>chars</em>.
<p> <p>See also <a href="#fromAscii">fromAscii</a>().
<p>Examples: <a href="listbox-example.html#x1446">listbox/listbox.cpp</a> and <a href="mail-example.html#x716">network/mail/smtp.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromLocal8Bit"></a>TQString::fromLocal8Bit ( const char * local8Bit, int len = -1 )<tt> [static]</tt>
</h3>
Returns the Unicode string decoded from the first <em>len</em>
bytes of <em>local8Bit</em>, ignoring the rest of <em>local8Bit</em>. If
<em>len</em> is -1 then the length of <em>local8Bit</em> is used. If <em>len</em> is
bigger than the length of <em>local8Bit</em> then it will use the length
of <em>local8Bit</em>.
<p> <pre>
TQString str = TQString::<a href="#fromLocal8Bit">fromLocal8Bit</a>( "123456789", 5 );
// str == "12345"
</pre>
<p> <em>local8Bit</em> is assumed to be encoded in a locale-specific format.
<p> See <a href="ntqtextcodec.html">TQTextCodec</a> for more diverse coding/decoding of Unicode strings.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromUcs2"></a>TQString::fromUcs2 ( const unsigned short * str )<tt> [static]</tt>
</h3>
Constructs a string that is a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as a
UCS2 encoded, zero terminated, Unicode string.
<p> If <em>str</em> is 0, then a null string is created.
<p> <p>See also <a href="#isNull">isNull</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="fromUtf8"></a>TQString::fromUtf8 ( const char * utf8, int len = -1 )<tt> [static]</tt>
</h3>
Returns the Unicode string decoded from the first <em>len</em>
bytes of <em>utf8</em>, ignoring the rest of <em>utf8</em>. If <em>len</em> is
-1 then the length of <em>utf8</em> is used. If <em>len</em> is bigger than
the length of <em>utf8</em> then it will use the length of <em>utf8</em>.
<p> <pre>
TQString str = TQString::<a href="#fromUtf8">fromUtf8</a>( "123456789", 5 );
// str == "12345"
</pre>
<p> See <a href="ntqtextcodec.html">TQTextCodec</a> for more diverse coding/decoding of Unicode strings.
<p>Example: <a href="simple-font-demo-example.html#x2850">fonts/simple-qfont-demo/viewer.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert"></a>TQString::insert ( uint index, const <a href="ntqstring.html">TQString</a> & s )
</h3>
Inserts <em>s</em> into the string at position <em>index</em>.
<p> If <em>index</em> is beyond the end of the string, the string is
extended with spaces to length <em>index</em> and <em>s</em> is then appended
and returns a reference to the string.
<p> <pre>
TQString string( "I like fish" );
str = string.<a href="#insert">insert</a>( 2, "don't " );
// str == "I don't like fish"
</pre>
<p> <p>See also <a href="#remove">remove</a>() and <a href="#replace">replace</a>().
<p>Examples: <a href="themes-example.html#x337">themes/themes.cpp</a> and <a href="xform-example.html#x1264">xform/xform.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert-2"></a>TQString::insert ( uint index, const <a href="qbytearray.html">TQByteArray</a> & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>s</em> into the string at position <em>index</em> and returns
a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert-3"></a>TQString::insert ( uint index, const char * s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>s</em> into the string at position <em>index</em> and returns
a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert-4"></a>TQString::insert ( uint index, const <a href="qchar.html">TQChar</a> * s, uint len )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts the first <em>len</em> characters in <em>s</em> into the string at
position <em>index</em> and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert-5"></a>TQString::insert ( uint index, <a href="qchar.html">TQChar</a> c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Insert <em>c</em> into the string at position <em>index</em> and returns a
reference to the string.
<p> If <em>index</em> is beyond the end of the string, the string is
extended with spaces (ASCII 32) to length <em>index</em> and <em>c</em> is
then appended.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="insert-6"></a>TQString::insert ( uint index, char c )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Insert character <em>c</em> at position <em>index</em>.
<h3 class=fn>bool <a name="isEmpty"></a>TQString::isEmpty () const
</h3>
<p> Returns TRUE if the string is empty, i.e. if <a href="#length">length</a>() == 0;
otherwise returns FALSE. Null strings are also empty.
<p> <pre>
TQString a( "" );
a.<a href="#isEmpty">isEmpty</a>(); // TRUE
a.<a href="#isNull">isNull</a>(); // FALSE
TQString b;
b.<a href="#isEmpty">isEmpty</a>(); // TRUE
b.<a href="#isNull">isNull</a>(); // TRUE
</pre>
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#length">length</a>().
<p>Examples: <a href="addressbook-example.html#x571">addressbook/mainwindow.cpp</a>, <a href="canvas-chart-example.html#x2892">chart/chartform.cpp</a>, <a href="tutorial2-06.html#x2576">chart/chartform_canvas.cpp</a>, <a href="networkprotocol-example.html#x691">network/networkprotocol/nntp.cpp</a>, <a href="qmag-example.html#x1792">qmag/qmag.cpp</a>, and <a href="qwerty-example.html#x390">qwerty/qwerty.cpp</a>.
<h3 class=fn>bool <a name="isNull"></a>TQString::isNull () const
</h3>
<p> Returns TRUE if the string is null; otherwise returns FALSE. A
null string is always empty.
<p> <pre>
TQString a; // a.<a href="#unicode">unicode</a>() == 0, a.<a href="#length">length</a>() == 0
a.<a href="#isNull">isNull</a>(); // TRUE, because a.<a href="#unicode">unicode</a>() == 0
a.<a href="#isEmpty">isEmpty</a>(); // TRUE, because a.<a href="#length">length</a>() == 0
</pre>
<p> <p>See also <a href="#isEmpty">isEmpty</a>() and <a href="#length">length</a>().
<p>Examples: <a href="i18n-example.html#x1948">i18n/main.cpp</a>, <a href="ftpclient-example.html#x771">network/ftpclient/ftpmainwindow.ui.h</a>, and <a href="qdir-example.html#x1842">qdir/qdir.cpp</a>.
<h3 class=fn>const char * <a name="latin1"></a>TQString::latin1 () const
</h3>
Returns a Latin-1 representation of the string. The
returned value is undefined if the string contains non-Latin-1
characters. If you want to convert strings into formats other than
Unicode, see the <a href="ntqtextcodec.html">TQTextCodec</a> classes.
<p> This function is mainly useful for boot-strapping legacy code to
use Unicode.
<p> The result remains valid so long as one unmodified copy of the
source string exists.
<p> <p>See also <a href="#fromLatin1">fromLatin1</a>(), <a href="#ascii">ascii</a>(), <a href="#utf8">utf8</a>(), and <a href="#local8Bit">local8Bit</a>().
<p>Examples: <a href="fileiconview-example.html#x869">fileiconview/qfileiconview.cpp</a> and <a href="networkprotocol-example.html#x692">network/networkprotocol/nntp.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="left"></a>TQString::left ( uint len ) const
</h3>
Returns a substring that contains the <em>len</em> leftmost characters
of the string.
<p> The whole string is returned if <em>len</em> exceeds the length of the
string.
<p> <pre>
TQString s = "Pineapple";
TQString t = s.<a href="#left">left</a>( 4 ); // t == "Pine"
</pre>
<p> <p>See also <a href="#right">right</a>(), <a href="#mid">mid</a>(), and <a href="#isEmpty">isEmpty</a>().
<p>Example: <a href="themes-example.html#x338">themes/themes.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="leftJustify"></a>TQString::leftJustify ( uint width, <a href="qchar.html">TQChar</a> fill = ' ', bool truncate = FALSE ) const
</h3>
Returns a string of length <em>width</em> that contains this string
padded by the <em>fill</em> character.
<p> If <em>truncate</em> is FALSE and the length of the string is more than
<em>width</em>, then the returned string is a copy of the string.
<p> If <em>truncate</em> is TRUE and the length of the string is more than
<em>width</em>, then any characters in a copy of the string after length
<em>width</em> are removed, and the copy is returned.
<p> <pre>
TQString s( "apple" );
TQString t = s.<a href="#leftJustify">leftJustify</a>( 8, '.' ); // t == "apple..."
</pre>
<p> <p>See also <a href="#rightJustify">rightJustify</a>().
<h3 class=fn>uint <a name="length"></a>TQString::length () const
</h3>
<p> Returns the length of the string.
<p> Null strings and empty strings have zero length.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<p>Examples: <a href="dirview-example.html#x1702">dirview/dirview.cpp</a>, <a href="fileiconview-example.html#x870">fileiconview/qfileiconview.cpp</a>, <a href="networkprotocol-example.html#x693">network/networkprotocol/nntp.cpp</a>, <a href="rot-example.html#x1372">rot13/rot13.cpp</a>, and <a href="themes-example.html#x339">themes/themes.cpp</a>.
<h3 class=fn><a href="ntqcstring.html">TQCString</a> <a name="local8Bit"></a>TQString::local8Bit () const
</h3>
Returns the string encoded in a locale-specific format. On X11,
this is the <a href="ntqtextcodec.html#codecForLocale">TQTextCodec::codecForLocale</a>(). On Windows, it is a
system-defined encoding. On Mac OS X, this always uses UTF-8 as
the encoding.
<p> See <a href="ntqtextcodec.html">TQTextCodec</a> for more diverse coding/decoding of Unicode
strings.
<p> <p>See also <a href="#fromLocal8Bit">fromLocal8Bit</a>(), <a href="#ascii">ascii</a>(), <a href="#latin1">latin1</a>(), and <a href="#utf8">utf8</a>().
<h3 class=fn>int <a name="localeAwareCompare"></a>TQString::localeAwareCompare ( const <a href="ntqstring.html">TQString</a> & s1, const <a href="ntqstring.html">TQString</a> & s2 )<tt> [static]</tt>
</h3>
<p> Compares <em>s1</em> with <em>s2</em> and returns an integer less than, equal
to, or greater than zero if <em>s1</em> is less than, equal to, or
greater than <em>s2</em>.
<p> The comparison is performed in a locale- and also
platform-dependent manner. Use this function to present sorted
lists of strings to the user.
<p> <p>See also <a href="#compare">TQString::compare</a>() and <a href="ntqtextcodec.html#locale">TQTextCodec::locale</a>().
<h3 class=fn>int <a name="localeAwareCompare-2"></a>TQString::localeAwareCompare ( const <a href="ntqstring.html">TQString</a> & s ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Compares this string with <em>s</em>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="lower"></a>TQString::lower () const
</h3>
Returns a lowercase copy of the string.
<p> <pre>
TQString string( "TROlltECH" );
str = string.<a href="#lower">lower</a>(); // str == "trolltech"
</pre>
<p> <p>See also <a href="#upper">upper</a>().
<p>Example: <a href="scribble-example.html#x941">scribble/scribble.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="mid"></a>TQString::mid ( uint index, uint len = 0xffffffff ) const
</h3>
Returns a string that contains the <em>len</em> characters of this
string, starting at position <em>index</em>.
<p> Returns a null string if the string is empty or <em>index</em> is out of
range. Returns the whole string from <em>index</em> if <em>index</em> + <em>len</em>
exceeds the length of the string.
<p> <pre>
TQString s( "Five pineapples" );
TQString t = s.<a href="#mid">mid</a>( 5, 4 ); // t == "pine"
</pre>
<p> <p>See also <a href="#left">left</a>() and <a href="#right">right</a>().
<p>Examples: <a href="mail-example.html#x717">network/mail/smtp.cpp</a>, <a href="qmag-example.html#x1793">qmag/qmag.cpp</a>, and <a href="themes-example.html#x340">themes/themes.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number"></a>TQString::number ( long n, int base = 10 )<tt> [static]</tt>
</h3>
A convenience function that returns a string equivalent of the
number <em>n</em> to base <em>base</em>, which is 10 by default and must be
between 2 and 36. The returned string is in "C" locale.
<p> <pre>
long a = 63;
TQString str = TQString::<a href="#number">number</a>( a, 16 ); // str == "3f"
TQString str = TQString::<a href="#number">number</a>( a, 16 ).upper(); // str == "3F"
</pre>
<p> <p>See also <a href="#setNum">setNum</a>().
<p>Examples: <a href="simple-application-example.html#x1580">application/application.cpp</a>, <a href="canvas-chart-example.html#x2893">chart/chartform.cpp</a>, <a href="simple-font-demo-example.html#x2851">fonts/simple-qfont-demo/viewer.cpp</a>, <a href="helpviewer-example.html#x1018">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2066">mdi/application.cpp</a>, <a href="regexptester-example.html#x2496">regexptester/regexptester.cpp</a>, and <a href="sql.html#x2193">sql/overview/extract/main.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-2"></a>TQString::number ( ulong n, int base = 10 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-3"></a>TQString::number ( TQ_LLONG n, int base = 10 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-4"></a>TQString::number ( TQ_ULLONG n, int base = 10 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-5"></a>TQString::number ( int n, int base = 10 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-6"></a>TQString::number ( uint n, int base = 10 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> A convenience factory function that returns a string
representation of the number <em>n</em> to the base <em>base</em>, which is 10
by default and must be between 2 and 36.
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="number-7"></a>TQString::number ( double n, char f = 'g', int prec = 6 )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Argument <em>n</em> is formatted according to the <em>f</em> format specified,
which is <tt>g</tt> by default, and can be any of the following:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Meaning
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>e</tt> <td valign="top">format as [-]9.9e[+|-]999
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>E</tt> <td valign="top">format as [-]9.9E[+|-]999
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>f</tt> <td valign="top">format as [-]9.9
<tr bgcolor="#d0d0d0"> <td valign="top"><tt>g</tt> <td valign="top">use <tt>e</tt> or <tt>f</tt> format, whichever is the most concise
<tr bgcolor="#f0f0f0"> <td valign="top"><tt>G</tt> <td valign="top">use <tt>E</tt> or <tt>f</tt> format, whichever is the most concise
</table></center>
<p> With 'e', 'E', and 'f', <em>prec</em> is the number of digits after the
decimal point. With 'g' and 'G', <em>prec</em> is the maximum number of
significant digits (trailing zeroes are omitted).
<p> <pre>
double d = 12.34;
TQString ds = <a href="#TQString">TQString</a>( "'E' format, precision 3, gives %1" )
.arg( d, 0, 'E', 3 );
// ds == "1.234E+001"
</pre>
<p> <p>See also <a href="#setNum">setNum</a>().
<h3 class=fn><a name="operator-const-char-*"></a>TQString::operator const char * () const
</h3>
<p> Returns <a href="#ascii">ascii</a>(). Be sure to see the warnings documented in the
ascii() function. Note that for new code which you wish to be
strictly Unicode-clean, you can define the macro <tt>TQT_NO_ASCII_CAST</tt> when compiling your code to hide this function so
that automatic casts are not done. This has the added advantage
that you catch the programming error described in <a href="#operator!">operator!</a>().
<h3 class=fn><a name="operator-std::string"></a>TQString::operator std::string () const
</h3>
<p> Returns <a href="#ascii">ascii</a>() as a std::string.
<p> <b>Warning:</b> The function may cause an application to crash if a static C run-time is in use.
This can happen in Microsoft Visual C++ if TQt is configured as single-threaded. A safe
alternative is to call ascii() directly and construct a std::string manually.
<h3 class=fn>bool <a name="operator!"></a>TQString::operator! () const
</h3>
<p> Returns TRUE if this is a null string; otherwise returns FALSE.
<p> <pre>
TQString name = getName();
if ( !name )
name = "Rodney";
</pre>
<p> Note that if you say
<p> <pre>
TQString name = getName();
if ( name )
doSomethingWith(name);
</pre>
<p> It will call "operator const char*()", which is inefficent; you
may wish to define the macro <tt>TQT_NO_ASCII_CAST</tt> when writing code
which you wish to remain Unicode-clean.
<p> When you want the above semantics, use:
<p> <pre>
TQString name = getName();
if ( !name.<a href="#isNull">isNull</a>() )
doSomethingWith(name);
</pre>
<p> <p>See also <a href="#isEmpty">isEmpty</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq"></a>TQString::operator+= ( const <a href="ntqstring.html">TQString</a> & str )
</h3>
Appends <em>str</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq-2"></a>TQString::operator+= ( const <a href="qbytearray.html">TQByteArray</a> & str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq-3"></a>TQString::operator+= ( const char * str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq-4"></a>TQString::operator+= ( const std::string & str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>str</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq-5"></a>TQString::operator+= ( <a href="qchar.html">TQChar</a> c )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>c</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator+-eq-6"></a>TQString::operator+= ( char c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Appends <em>c</em> to the string and returns a reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq"></a>TQString::operator= ( <a href="qchar.html">TQChar</a> c )
</h3>
<p> Sets the string to contain just the single character <em>c</em>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq-2"></a>TQString::operator= ( const <a href="ntqstring.html">TQString</a> & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Assigns a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>s</em> to this string and returns a
reference to this string. This is very fast because the string
isn't actually copied.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq-3"></a>TQString::operator= ( const char * str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>str</em>, interpreted as a classic C string
to this string and returns a reference to this string.
<p> If <em>str</em> is 0, then a null string is created.
<p> <p>See also <a href="#isNull">isNull</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq-4"></a>TQString::operator= ( const std::string & s )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Makes a <a href="shclass.html#deep-copy">deep copy</a> of <em>s</em> and returns a reference to the deep
copy.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq-5"></a>TQString::operator= ( const <a href="ntqcstring.html">TQCString</a> & cstr )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Assigns a <a href="shclass.html#deep-copy">deep copy</a> of <em>cstr</em>, interpreted as a classic C
string, to this string. Returns a reference to this string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="operator-eq-6"></a>TQString::operator= ( char c )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to contain just the single character <em>c</em>.
<h3 class=fn><a href="qchar.html">TQChar</a> <a name="operator[]"></a>TQString::operator[] ( int i ) const
</h3>
<p> Returns the character at index <em>i</em>, or TQChar::null if <em>i</em> is
beyond the length of the string.
<p> If the TQString is not const (i.e., const TQString) or const&
(i.e., const TQString&), then the non-const overload of operator[]
will be used instead.
<h3 class=fn><a href="qcharref.html">TQCharRef</a> <a name="operator[]-2"></a>TQString::operator[] ( int i )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> The function returns a reference to the character at index <em>i</em>.
The resulting reference can then be assigned to, or used
immediately, but it will become invalid once further modifications
are made to the original string.
<p> If <em>i</em> is beyond the length of the string then the string is
expanded with TQChar::nulls, so that the <a href="qcharref.html">TQCharRef</a> references a
valid (null) character in the string.
<p> The TQCharRef internal class can be used much like a constant
<a href="qchar.html">TQChar</a>, but if you assign to it, you change the original string
(which will detach itself because of TQString's copy-on-write
semantics). You will get compilation errors if you try to use the
result as anything but a TQChar.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend"></a>TQString::prepend ( const <a href="ntqstring.html">TQString</a> & s )
</h3>
<p> Inserts <em>s</em> at the beginning of the string and returns a
reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
<p> <pre>
TQString string = "42";
string.<a href="#prepend">prepend</a>( "The answer is " );
// string == "The answer is 42"
</pre>
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend-2"></a>TQString::prepend ( char ch )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>ch</em> at the beginning of the string and returns a
reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>ch</em>).
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend-3"></a>TQString::prepend ( <a href="qchar.html">TQChar</a> ch )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>ch</em> at the beginning of the string and returns a
reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>ch</em>).
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend-4"></a>TQString::prepend ( const <a href="qbytearray.html">TQByteArray</a> & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend-5"></a>TQString::prepend ( const char * s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="prepend-6"></a>TQString::prepend ( const std::string & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts <em>s</em> at the beginning of the string and returns a reference to the string.
<p> Equivalent to <a href="#insert">insert</a>(0, <em>s</em>).
<p> <p>See also <a href="#insert">insert</a>().
<h3 class=fn><a href="qchar.html">TQChar</a> & <a name="ref"></a>TQString::ref ( uint i )
</h3>
<p> Returns the <a href="qchar.html">TQChar</a> at index <em>i</em> by reference, expanding the string
with TQChar::null if necessary. The resulting reference can be
assigned to, or otherwise used immediately, but becomes invalid
once furher modifications are made to the string.
<p> <pre>
TQString string("ABCDEF");
<a href="qchar.html">TQChar</a> ch = string.<a href="#ref">ref</a>( 3 ); // ch == 'D'
</pre>
<p> <p>See also <a href="#constref">constref</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove"></a>TQString::remove ( uint index, uint len )
</h3>
Removes <em>len</em> characters from the string starting at position <em>index</em>, and returns a reference to the string.
<p> If <em>index</em> is beyond the length of the string, nothing happens.
If <em>index</em> is within the string, but <em>index</em> + <em>len</em> is beyond
the end of the string, the string is truncated at position <em>index</em>.
<p> <pre>
TQString string( "Montreal" );
string.<a href="#remove">remove</a>( 1, 4 ); // string == "Meal"
</pre>
<p> <p>See also <a href="#insert">insert</a>() and <a href="#replace">replace</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove-2"></a>TQString::remove ( const <a href="ntqstring.html">TQString</a> & str, bool cs = TRUE )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Removes every occurrence of <em>str</em> in the string. Returns a
reference to the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> This is the same as <a href="#replace">replace</a>(<em>str</em>, "", <em>cs</em>).
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove-3"></a>TQString::remove ( <a href="qchar.html">TQChar</a> c )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Removes every occurrence of the character <em>c</em> in the string.
Returns a reference to the string.
<p> This is the same as <a href="#replace">replace</a>(<em>c</em>, "").
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove-4"></a>TQString::remove ( char c )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Removes every occurrence of the character <em>c</em> in the string.
Returns a reference to the string.
<p> This is the same as <a href="#replace">replace</a>(<em>c</em>, "").
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove-5"></a>TQString::remove ( const char * str )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Removes every occurrence of <em>str</em> in the string. Returns a
reference to the string.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="remove-6"></a>TQString::remove ( const <a href="ntqregexp.html">TQRegExp</a> & rx )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Removes every occurrence of the <a href="ntqregexp.html#regular-expression">regular expression</a> <em>rx</em> in the
string. Returns a reference to the string.
<p> This is the same as <a href="#replace">replace</a>(<em>rx</em>, "").
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace"></a>TQString::replace ( uint index, uint len, const <a href="ntqstring.html">TQString</a> & s )
</h3>
Replaces <em>len</em> characters from the string with <em>s</em>, starting at
position <em>index</em>, and returns a reference to the string.
<p> If <em>index</em> is beyond the length of the string, nothing is deleted
and <em>s</em> is appended at the end of the string. If <em>index</em> is
valid, but <em>index</em> + <em>len</em> is beyond the end of the string,
the string is truncated at position <em>index</em>, then <em>s</em> is
appended at the end.
<p> <pre>
TQString string( "Say yes!" );
string = string.<a href="#replace">replace</a>( 4, 3, "NO" );
// string == "Say NO!"
</pre>
<p> <b>Warning:</b> TQt 3.3.3 and earlier had different semantics for the
case <em>index</em> >= <a href="#length">length</a>(), which contradicted the documentation.
To avoid portability problems between TQt 3 versions and with TQt
4, we recommend that you never call the function with <em>index</em> >=
length().
<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
<p>Examples: <a href="listviews-example.html#x162">listviews/listviews.cpp</a>, <a href="networkprotocol-example.html#x694">network/networkprotocol/nntp.cpp</a>, <a href="qmag-example.html#x1794">qmag/qmag.cpp</a>, and <a href="regexptester-example.html#x2497">regexptester/regexptester.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-2"></a>TQString::replace ( uint index, uint len, const <a href="qchar.html">TQChar</a> * s, uint slen )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces <em>len</em> characters with <em>slen</em> characters of <a href="qchar.html">TQChar</a> data
from <em>s</em>, starting at position <em>index</em>, and returns a reference
to the string.
<p> <p>See also <a href="#insert">insert</a>() and <a href="#remove">remove</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-3"></a>TQString::replace ( uint index, uint len, <a href="qchar.html">TQChar</a> c )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This is the same as <a href="#replace">replace</a>(<em>index</em>, <em>len</em>, TQString(<em>c</em>)).
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-4"></a>TQString::replace ( uint index, uint len, char c )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> This is the same as <a href="#replace">replace</a>(<em>index</em>, <em>len</em>, <a href="qchar.html">TQChar</a>(<em>c</em>)).
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-5"></a>TQString::replace ( <a href="qchar.html">TQChar</a> c, const <a href="ntqstring.html">TQString</a> & after, bool cs = TRUE )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces every occurrence of the character <em>c</em> in the string
with <em>after</em>. Returns a reference to the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> Example:
<pre>
TQString s = "a,b,c";
s.<a href="#replace">replace</a>( TQChar(','), " or " );
// s == "a or b or c"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-6"></a>TQString::replace ( char c, const <a href="ntqstring.html">TQString</a> & after, bool cs = TRUE )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Replaces every occurrence of the character <em>c</em> in the string
with <em>after</em>. Returns a reference to the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-7"></a>TQString::replace ( const <a href="ntqstring.html">TQString</a> & before, const <a href="ntqstring.html">TQString</a> & after, bool cs = TRUE )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces every occurrence of the string <em>before</em> in the string
with the string <em>after</em>. Returns a reference to the string.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> Example:
<pre>
TQString s = "Greek is Greek";
s.<a href="#replace">replace</a>( "Greek", "English" );
// s == "English is English"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-8"></a>TQString::replace ( const <a href="ntqregexp.html">TQRegExp</a> & rx, const <a href="ntqstring.html">TQString</a> & after )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces every occurrence of the regexp <em>rx</em> in the string with
<em>after</em>. Returns a reference to the string. For example:
<pre>
TQString s = "banana";
s.<a href="#replace">replace</a>( TQRegExp("an"), "" );
// s == "ba"
</pre>
<p> For regexps containing <a href="ntqregexp.html#capturing-text">capturing
parentheses</a>, occurrences of <b>\1</b>, <b>\2</b>, ...,
in <em>after</em> are replaced with <em>rx</em>.cap(1), cap(2), ...
<p> <pre>
TQString t = "A <i>bon mot</i>.";
t.<a href="#replace">replace</a>( TQRegExp("<i>([^<]*)</i>"), "\\emph{\\1}" );
// t == "A \\emph{bon mot}."
</pre>
<p> <p>See also <a href="#find">find</a>(), <a href="#findRev">findRev</a>(), and <a href="ntqregexp.html#cap">TQRegExp::cap</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="replace-9"></a>TQString::replace ( <a href="qchar.html">TQChar</a> c1, <a href="qchar.html">TQChar</a> c2 )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Replaces every occurrence of <em>c1</em> with the char <em>c2</em>. Returns a
reference to the string.
<h3 class=fn>void <a name="reserve"></a>TQString::reserve ( uint minCapacity )
</h3>
Ensures that at least <em>minCapacity</em> characters are allocated to
the string.
<p> This function is useful for code that needs to build up a long
string and wants to avoid repeated reallocation. In this example,
we want to add to the string until some condition is true, and
we're fairly sure that size is big enough:
<pre>
TQString result;
int len = 0;
result.<a href="#reserve">reserve</a>(maxLen);
while (...) {
result[len++] = ... // fill part of the space
}
result.<a href="#squeeze">squeeze</a>();
</pre>
<p> If <em>maxLen</em> is an underestimate, the worst that will happen is
that the loop will slow down.
<p> If it is not possible to allocate enough memory, the string
remains unchanged.
<p> <p>See also <a href="#capacity">capacity</a>(), <a href="#squeeze">squeeze</a>(), and <a href="#setLength">setLength</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="right"></a>TQString::right ( uint len ) const
</h3>
Returns a string that contains the <em>len</em> rightmost characters of
the string.
<p> If <em>len</em> is greater than the length of the string then the whole
string is returned.
<p> <pre>
TQString string( "Pineapple" );
TQString t = string.<a href="#right">right</a>( 5 ); // t == "apple"
</pre>
<p> <p>See also <a href="#left">left</a>(), <a href="#mid">mid</a>(), and <a href="#isEmpty">isEmpty</a>().
<p>Example: <a href="fileiconview-example.html#x871">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="rightJustify"></a>TQString::rightJustify ( uint width, <a href="qchar.html">TQChar</a> fill = ' ', bool truncate = FALSE ) const
</h3>
Returns a string of length <em>width</em> that contains the <em>fill</em>
character followed by the string.
<p> If <em>truncate</em> is FALSE and the length of the string is more than
<em>width</em>, then the returned string is a copy of the string.
<p> If <em>truncate</em> is TRUE and the length of the string is more than
<em>width</em>, then the resulting string is truncated at position <em>width</em>.
<p> <pre>
TQString string( "apple" );
TQString t = string.<a href="#rightJustify">rightJustify</a>( 8, '.' ); // t == "...apple"
</pre>
<p> <p>See also <a href="#leftJustify">leftJustify</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="section"></a>TQString::section ( <a href="qchar.html">TQChar</a> sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const
</h3>
<p> This function returns a section of the string.
<p> This string is treated as a sequence of fields separated by the
character, <em>sep</em>. The returned string consists of the fields from
position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not
specified, all fields from position <em>start</em> to the end of the
string are included. Fields are numbered 0, 1, 2, etc., counting
from the left, and -1, -2, etc., counting from right to left.
<p> The <em>flags</em> argument can be used to affect some aspects of the
function's behaviour, e.g. whether to be case sensitive, whether
to skip empty fields and how to deal with leading and trailing
separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
<p> <pre>
TQString csv( "forename,middlename,surname,phone" );
TQString s = csv.<a href="#section">section</a>( ',', 2, 2 ); // s == "surname"
TQString path( "/usr/local/bin/myapp" ); // First field is empty
TQString s = path.<a href="#section">section</a>( '/', 3, 4 ); // s == "bin/myapp"
TQString s = path.<a href="#section">section</a>( '/', 3, 3, SectionSkipEmpty ); // s == "myapp"
</pre>
<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
of the string, the right-most field being -1, the one from
right-most field being -2, and so on.
<p> <pre>
TQString csv( "forename,middlename,surname,phone" );
TQString s = csv.<a href="#section">section</a>( ',', -3, -2 ); // s == "middlename,surname"
TQString path( "/usr/local/bin/myapp" ); // First field is empty
TQString s = path.<a href="#section">section</a>( '/', -1 ); // s == "myapp"
</pre>
<p> <p>See also <a href="ntqstringlist.html#split">TQStringList::split</a>().
<p>Examples: <a href="tutorial2-03.html#x2551">chart/element.cpp</a> and <a href="ftpclient-example.html#x772">network/ftpclient/ftpmainwindow.ui.h</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="section-2"></a>TQString::section ( char sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="section-3"></a>TQString::section ( const char * sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="section-4"></a>TQString::section ( const <a href="ntqstring.html">TQString</a> & sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function returns a section of the string.
<p> This string is treated as a sequence of fields separated by the
string, <em>sep</em>. The returned string consists of the fields from
position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not
specified, all fields from position <em>start</em> to the end of the
string are included. Fields are numbered 0, 1, 2, etc., counting
from the left, and -1, -2, etc., counting from right to left.
<p> The <em>flags</em> argument can be used to affect some aspects of the
function's behaviour, e.g. whether to be case sensitive, whether
to skip empty fields and how to deal with leading and trailing
separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
<p> <pre>
TQString data( "forename**middlename**surname**phone" );
TQString s = data.<a href="#section">section</a>( "**", 2, 2 ); // s == "surname"
</pre>
<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
of the string, the right-most field being -1, the one from
right-most field being -2, and so on.
<p> <pre>
TQString data( "forename**middlename**surname**phone" );
TQString s = data.<a href="#section">section</a>( "**", -3, -2 ); // s == "middlename**surname"
</pre>
<p> <p>See also <a href="ntqstringlist.html#split">TQStringList::split</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="section-5"></a>TQString::section ( const <a href="ntqregexp.html">TQRegExp</a> & reg, int start, int end = 0xffffffff, int flags = SectionDefault ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function returns a section of the string.
<p> This string is treated as a sequence of fields separated by the
<a href="ntqregexp.html#regular-expression">regular expression</a>, <em>reg</em>. The returned string consists of the
fields from position <em>start</em> to position <em>end</em> inclusive. If <em>end</em> is not specified, all fields from position <em>start</em> to the end
of the string are included. Fields are numbered 0, 1, 2, etc., counting
from the left, and -1, -2, etc., counting from right to left.
<p> The <em>flags</em> argument can be used to affect some aspects of the
function's behaviour, e.g. whether to be case sensitive, whether
to skip empty fields and how to deal with leading and trailing
separators; see <a href="#SectionFlags-enum">SectionFlags</a>.
<p> <pre>
TQString line( "forename\tmiddlename surname \t \t phone" );
<a href="ntqregexp.html">TQRegExp</a> sep( "\s+" );
TQString s = line.<a href="#section">section</a>( sep, 2, 2 ); // s == "surname"
</pre>
<p> If <em>start</em> or <em>end</em> is negative, we count fields from the right
of the string, the right-most field being -1, the one from
right-most field being -2, and so on.
<p> <pre>
TQString line( "forename\tmiddlename surname \t \t phone" );
<a href="ntqregexp.html">TQRegExp</a> sep( "\\s+" );
TQString s = line.<a href="#section">section</a>( sep, -3, -2 ); // s == "middlename surname"
</pre>
<p> <b>Warning:</b> Using this <a href="ntqregexp.html">TQRegExp</a> version is much more expensive than
the overloaded string and character versions.
<p> <p>See also <a href="ntqstringlist.html#split">TQStringList::split</a>() and <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setAscii"></a>TQString::setAscii ( const char * str, int len = -1 )
</h3>
Sets this string to <em>str</em>, interpreted as a classic 8-bit ASCII C
string. If <em>len</em> is -1 (the default), then it is set to
strlen(str).
<p> If <em>str</em> is 0 a null string is created. If <em>str</em> is "", an empty
string is created.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>void <a name="setExpand"></a>TQString::setExpand ( uint index, <a href="qchar.html">TQChar</a> c )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Sets the character at position <em>index</em> to <em>c</em> and expands the
string if necessary, filling with spaces.
<p> This method is redundant in TQt 3.x, because operator[] will expand
the string as necessary.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setLatin1"></a>TQString::setLatin1 ( const char * str, int len = -1 )
</h3>
Sets this string to <em>str</em>, interpreted as a classic Latin-1 C
string. If <em>len</em> is -1 (the default), then it is set to
strlen(str).
<p> If <em>str</em> is 0 a null string is created. If <em>str</em> is "", an empty
string is created.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>void <a name="setLength"></a>TQString::setLength ( uint newLen )
</h3>
Ensures that at least <em>newLen</em> characters are allocated to the
string, and sets the length of the string to <em>newLen</em>. Any new
space allocated contains arbitrary data.
<p> <p>See also <a href="#reserve">reserve</a>() and <a href="#truncate">truncate</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum"></a>TQString::setNum ( TQ_LLONG n, int base = 10 )
</h3>
Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string. The returned string is in "C" locale.
<p> The base is 10 by default and must be between 2 and 36.
<p> <pre>
TQString string;
string = string.<a href="#setNum">setNum</a>( 1234 ); // string == "1234"
</pre>
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-2"></a>TQString::setNum ( short n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string.
<p> The base is 10 by default and must be between 2 and 36.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-3"></a>TQString::setNum ( ushort n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string.
<p> The base is 10 by default and must be between 2 and 36.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-4"></a>TQString::setNum ( int n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string.
<p> The base is 10 by default and must be between 2 and 36.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-5"></a>TQString::setNum ( uint n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string.
<p> The base is 10 by default and must be between 2 and 36.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-6"></a>TQString::setNum ( long n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-7"></a>TQString::setNum ( ulong n, int base = 10 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-8"></a>TQString::setNum ( TQ_ULLONG n, int base = 10 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em> in base <em>base</em> and
returns a reference to the string.
<p> The base is 10 by default and must be between 2 and 36.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-9"></a>TQString::setNum ( float n, char f = 'g', int prec = 6 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em>, formatted in format
<em>f</em> with precision <em>prec</em>, and returns a reference to the
string.
<p> The format <em>f</em> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See <a href="#arg-formats">arg</a>() for an explanation of the formats.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setNum-a"></a>TQString::setNum ( double n, char f = 'g', int prec = 6 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the string to the printed value of <em>n</em>, formatted in format
<em>f</em> with precision <em>prec</em>, and returns a reference to the
string.
<p> The format <em>f</em> can be 'f', 'F', 'e', 'E', 'g' or 'G'. See <a href="#arg-formats">arg</a>() for an explanation of the formats.
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setUnicode"></a>TQString::setUnicode ( const <a href="qchar.html">TQChar</a> * unicode, uint len )
</h3>
Resizes the string to <em>len</em> characters and copies <em>unicode</em> into
the string. If <em>unicode</em> is 0, nothing is copied, but the
string is still resized to <em>len</em>. If <em>len</em> is zero, then the
string becomes a <a href="#isNull">null</a> string.
<p> <p>See also <a href="#setLatin1">setLatin1</a>() and <a href="#isNull">isNull</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="setUnicodeCodes"></a>TQString::setUnicodeCodes ( const ushort * unicode_as_ushorts, uint len )
</h3>
Resizes the string to <em>len</em> characters and copies <em>unicode_as_ushorts</em> into the string (on some X11 client platforms
this will involve a byte-swapping pass).
<p> If <em>unicode_as_ushorts</em> is 0, nothing is copied, but the string
is still resized to <em>len</em>. If <em>len</em> is zero, the string becomes
a <a href="#isNull">null</a> string.
<p> <p>See also <a href="#setLatin1">setLatin1</a>() and <a href="#isNull">isNull</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="simplifyWhiteSpace"></a>TQString::simplifyWhiteSpace () const
</h3>
Returns a string that has whitespace removed from the start and
the end, and which has each sequence of internal whitespace
replaced with a single space.
<p> Whitespace means any character for which <a href="qchar.html#isSpace">TQChar::isSpace</a>() returns
TRUE. This includes Unicode characters with decimal values 9
(TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR), and 32 (Space).
<p> <pre>
TQString string = " lots\t of\nwhite space ";
TQString t = string.<a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>();
// t == "lots of white space"
</pre>
<p> <p>See also <a href="#stripWhiteSpace">stripWhiteSpace</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> & <a name="sprintf"></a>TQString::sprintf ( const char * cformat, ... )
</h3>
Safely builds a formatted string from the format string <em>cformat</em>
and an arbitrary list of arguments. The format string supports all
the escape sequences of printf() in the standard C library.
<p> The %s escape sequence expects a <a href="#utf8">utf8</a>() encoded string. The format
string <em>cformat</em> is expected to be in latin1. If you need a
Unicode format string, use <a href="#arg">arg</a>() instead. For typesafe string
building, with full Unicode support, you can use <a href="qtextostream.html">TQTextOStream</a> like
this:
<p> <pre>
TQString str;
TQString s = ...;
int x = ...;
TQTextOStream( &str ) << s << " : " << x;
</pre>
<p> For <a href="ntqobject.html#tr">translations,</a> especially if the
strings contains more than one escape sequence, you should
consider using the arg() function instead. This allows the order
of the replacements to be controlled by the translator, and has
Unicode support.
<p> The %lc escape sequence expects a unicode character of type ushort
(as returned by <a href="qchar.html#unicode">TQChar::unicode</a>()).
The %ls escape sequence expects a pointer to a zero-terminated
array of unicode characters of type ushort (as returned by
<a href="#ucs2">TQString::ucs2</a>()).
<p> <p>See also <a href="#arg">arg</a>().
<p>Examples: <a href="dclock-example.html#x1103">dclock/dclock.cpp</a>, <a href="forever-example.html#x1052">forever/forever.cpp</a>, <a href="layout-example.html#x542">layout/layout.cpp</a>, <a href="qmag-example.html#x1795">qmag/qmag.cpp</a>, <a href="scrollview-example.html#x656">scrollview/scrollview.cpp</a>, <a href="tooltip-example.html#x449">tooltip/tooltip.cpp</a>, and <a href="xform-example.html#x1265">xform/xform.cpp</a>.
<h3 class=fn>void <a name="squeeze"></a>TQString::squeeze ()
</h3>
Squeezes the string's capacity to the current content.
<p> <p>See also <a href="#capacity">capacity</a>() and <a href="#reserve">reserve</a>().
<h3 class=fn>bool <a name="startsWith"></a>TQString::startsWith ( const <a href="ntqstring.html">TQString</a> & s, bool cs = TRUE ) const
</h3>
Returns TRUE if the string starts with <em>s</em>; otherwise returns
FALSE.
<p> If <em>cs</em> is TRUE (the default), the search is case sensitive;
otherwise the search is case insensitive.
<p> <pre>
TQString str( "Bananas" );
str.<a href="#startsWith">startsWith</a>( "Ban" ); // returns TRUE
str.<a href="#startsWith">startsWith</a>( "Car" ); // returns FALSE
</pre>
<p> <p>See also <a href="#endsWith">endsWith</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="stripWhiteSpace"></a>TQString::stripWhiteSpace () const
</h3>
Returns a string that has whitespace removed from the start and
the end.
<p> Whitespace means any character for which <a href="qchar.html#isSpace">TQChar::isSpace</a>() returns
TRUE. This includes Unicode characters with decimal values 9
(TAB), 10 (LF), 11 (VT), 12 (FF), 13 (CR) and 32 (Space), and may
also include other Unicode characters.
<p> <pre>
TQString string = " white space ";
TQString s = string.<a href="#stripWhiteSpace">stripWhiteSpace</a>(); // s == "white space"
</pre>
<p> <p>See also <a href="#simplifyWhiteSpace">simplifyWhiteSpace</a>().
<h3 class=fn>double <a name="toDouble"></a>TQString::toDouble ( bool * ok = 0 ) const
</h3>
Returns the string converted to a <tt>double</tt> value.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> <pre>
TQString string( "1234.56" );
double a = string.<a href="#toDouble">toDouble</a>(); // a == 1234.56
</pre>
<p> The string-to-number functions:
<ul>
<li> <a href="#toShort">toShort</a>()
<li> <a href="#toUShort">toUShort</a>()
<li> <a href="#toInt">toInt</a>()
<li> <a href="#toUInt">toUInt</a>()
<li> <a href="#toLong">toLong</a>()
<li> <a href="#toULong">toULong</a>()
<li> <a href="#toLongLong">toLongLong</a>()
<li> <a href="#toULongLong">toULongLong</a>()
<li> <a href="#toFloat">toFloat</a>()
<li> <a href="#toDouble">toDouble</a>()
</ul>
can handle numbers
represented in various locales. These representations may use different
characters for the decimal point, thousands group sepearator
and even individual digits. TQString's functions try to interpret
the string according to the current locale. The current locale is
determined from the system at application startup and can be changed
by calling <a href="ntqlocale.html#setDefault">TQLocale::setDefault</a>(). If the string cannot be interpreted
according to the current locale, this function falls back
on the "C" locale.
<p> <pre>
bool ok;
double d;
TQLocale::<a href="ntqlocale.html#setDefault">setDefault</a>(TQLocale::C);
d = <a href="#TQString">TQString</a>( "1234,56" ).toDouble(&ok); // ok == false
d = <a href="#TQString">TQString</a>( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56
TQLocale::<a href="ntqlocale.html#setDefault">setDefault</a>(TQLocale::German);
d = <a href="#TQString">TQString</a>( "1234,56" ).toDouble(&ok); // ok == true, d == 1234.56
d = <a href="#TQString">TQString</a>( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56
</pre>
<p> Due to the ambiguity between the decimal point and thousands group
separator in various locales, these functions do not handle
thousands group separators. If you need to convert such numbers,
use the corresponding function in <a href="ntqlocale.html">TQLocale</a>.
<p> <pre>
bool ok;
TQLocale::<a href="ntqlocale.html#setDefault">setDefault</a>(TQLocale::C);
double d = <a href="#TQString">TQString</a>( "1,234,567.89" ).toDouble(&ok); // ok == false
</pre>
<p> <b>Warning:</b> If the string contains trailing whitespace this function
will fail, and set <em>*ok</em> to false if <em>ok</em> is not 0. Leading
whitespace is ignored.
<p> <p>See also <a href="#number">number</a>(), <a href="ntqlocale.html#setDefault">TQLocale::setDefault</a>(), <a href="ntqlocale.html#toDouble">TQLocale::toDouble</a>(), and <a href="#stripWhiteSpace">stripWhiteSpace</a>().
<h3 class=fn>float <a name="toFloat"></a>TQString::toFloat ( bool * ok = 0 ) const
</h3>
Returns the string converted to a <tt>float</tt> value.
<p> Returns 0.0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <b>Warning:</b> If the string contains trailing whitespace this function
will fail, settings <em>*ok</em> to false if <em>ok</em> is not 0.
Leading whitespace is ignored.
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>int <a name="toInt"></a>TQString::toInt ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to an <tt>int</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> <pre>
TQString str( "FF" );
bool ok;
int hex = str.<a href="#toInt">toInt</a>( &ok, 16 ); // hex == 255, ok == TRUE
int dec = str.<a href="#toInt">toInt</a>( &ok, 10 ); // dec == 0, ok == FALSE
</pre>
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>long <a name="toLong"></a>TQString::toLong ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to a <tt>long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>TQ_LLONG <a name="toLongLong"></a>TQString::toLongLong ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to a <tt>long long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>short <a name="toShort"></a>TQString::toShort ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to a <tt>short</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>uint <a name="toUInt"></a>TQString::toUInt ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to an <tt>unsigned int</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>ulong <a name="toULong"></a>TQString::toULong ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to an <tt>unsigned long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>TQ_ULLONG <a name="toULongLong"></a>TQString::toULongLong ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to an <tt>unsigned long long</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>ushort <a name="toUShort"></a>TQString::toUShort ( bool * ok = 0, int base = 10 ) const
</h3>
Returns the string converted to an <tt>unsigned short</tt> using base <em>base</em>, which is 10 by default and must be between 2 and 36 or 0. If
<em>base</em> is 0, the base is determined automatically using the
following rules:
<ul>
<li>If the string begins with "0x", it is assumed to
be hexadecimal;
<li>If it begins with "0", it is assumed to be octal;
<li>Otherwise it is assumed to be decimal.
</ul>
<p> Returns 0 if the conversion fails.
<p> If <em>ok</em> is not 0: if a conversion error occurs, <em>*ok</em> is set to
FALSE; otherwise <em>*ok</em> is set to TRUE.
<p> Leading and trailing whitespace is ignored by this function.
<p> For information on how string-to-number functions in TQString handle
localized input, see <a href="#toDouble">toDouble</a>().
<p> <p>See also <a href="#number">number</a>().
<h3 class=fn>void <a name="truncate"></a>TQString::truncate ( uint newLen )
</h3>
If <em>newLen</em> is less than the length of the string, then the
string is truncated at position <em>newLen</em>. Otherwise nothing
happens.
<p> <pre>
TQString s = "truncate me";
s.<a href="#truncate">truncate</a>( 5 ); // s == "trunc"
</pre>
<p> <p>See also <a href="#setLength">setLength</a>().
<p>Example: <a href="mail-example.html#x718">network/mail/smtp.cpp</a>.
<h3 class=fn>const unsigned short * <a name="ucs2"></a>TQString::ucs2 () const
</h3>
Returns the TQString as a zero terminated array of unsigned shorts
if the string is not null; otherwise returns zero.
<p> The result remains valid so long as one unmodified
copy of the source string exists.
<p>Example: <a href="activeqt-dotnet.html#x2467">dotnet/wrapper/lib/tools.cpp</a>.
<h3 class=fn>const <a href="qchar.html">TQChar</a> * <a name="unicode"></a>TQString::unicode () const
</h3>
<p> Returns the Unicode representation of the string. The result
remains valid until the string is modified.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="upper"></a>TQString::upper () const
</h3>
Returns an uppercase copy of the string.
<p> <pre>
TQString string( "TeXt" );
str = string.<a href="#upper">upper</a>(); // t == "TEXT"
</pre>
<p> <p>See also <a href="#lower">lower</a>().
<p>Examples: <a href="scribble-example.html#x942">scribble/scribble.cpp</a> and <a href="sql.html#x2240">sql/overview/custom1/main.cpp</a>.
<h3 class=fn><a href="ntqcstring.html">TQCString</a> <a name="utf8"></a>TQString::utf8 () const
</h3>
Returns the string encoded in UTF-8 format.
<p> See <a href="ntqtextcodec.html">TQTextCodec</a> for more diverse coding/decoding of Unicode strings.
<p> <p>See also <a href="#fromUtf8">fromUtf8</a>(), <a href="#ascii">ascii</a>(), <a href="#latin1">latin1</a>(), and <a href="#local8Bit">local8Bit</a>().
<p>Example: <a href="archivesearch-example.html#x483">network/archivesearch/archivedialog.ui.h</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const <a href="ntqstring.html">TQString</a> & s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator!-eq-2"></a>operator!= ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator!-eq-3"></a>operator!= ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is not equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) != 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>const <a href="ntqstring.html">TQString</a> <a name="operator+"></a>operator+ ( const <a href="ntqstring.html">TQString</a> & s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p>
<p> Returns a string which is the result of concatenating the string
<em>s1</em> and the string <em>s2</em>.
<p> Equivalent to <em>s1</em>.<a href="#append">append</a>(<em>s2</em>).
<h3 class=fn>const <a href="ntqstring.html">TQString</a> <a name="operator+-2"></a>operator+ ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns a string which is the result of concatenating the string
<em>s1</em> and character <em>s2</em>.
<p> Equivalent to <em>s1</em>.<a href="#append">append</a>(<em>s2</em>).
<h3 class=fn>const <a href="ntqstring.html">TQString</a> <a name="operator+-3"></a>operator+ ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns a string which is the result of concatenating the
character <em>s1</em> and string <em>s2</em>.
<h3 class=fn>const <a href="ntqstring.html">TQString</a> <a name="operator+-4"></a>operator+ ( const <a href="ntqstring.html">TQString</a> & s, char c )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns a string which is the result of concatenating the string
<em>s</em> and character <em>c</em>.
<p> Equivalent to <em>s</em>.<a href="#append">append</a>(<em>c</em>).
<h3 class=fn>const <a href="ntqstring.html">TQString</a> <a name="operator+-5"></a>operator+ ( char c, const <a href="ntqstring.html">TQString</a> & s )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns a string which is the result of concatenating the
character <em>c</em> and string <em>s</em>.
<p> Equivalent to <em>s</em>.<a href="#prepend">prepend</a>(<em>c</em>).
<h3 class=fn>bool <a name="operator-lt"></a>operator< ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is lexically less than <em>s2</em>; otherwise returns FALSE.
The comparison is case sensitive.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) < 0.
<h3 class=fn>bool <a name="operator-lt-2"></a>operator< ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is lexically less than <em>s2</em>; otherwise returns FALSE.
The comparison is case sensitive.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) < 0.
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="ntqdatastream.html">TQDataStream</a> & s, const <a href="ntqstring.html">TQString</a> & str )
</h3>
<p> Writes the string <em>str</em> to the stream <em>s</em>.
<p> See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>
<h3 class=fn>bool <a name="operator-lt-eq"></a>operator<= ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is lexically less than or equal to <em>s2</em>;
otherwise returns FALSE.
The comparison is case sensitive.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>,<em>s2</em>) <= 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-lt-eq-2"></a>operator<= ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is lexically less than or equal to <em>s2</em>;
otherwise returns FALSE.
The comparison is case sensitive.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) <= 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const <a href="ntqstring.html">TQString</a> & s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-eq-eq-2"></a>operator== ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-eq-eq-3"></a>operator== ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is equal to <em>s2</em>; otherwise returns FALSE.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) == 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-gt"></a>operator> ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is lexically greater than <em>s2</em>; otherwise
returns FALSE.
The comparison is case sensitive.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) > 0.
<h3 class=fn>bool <a name="operator-gt-2"></a>operator> ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is lexically greater than <em>s2</em>; otherwise
returns FALSE.
The comparison is case sensitive.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) > 0.
<h3 class=fn>bool <a name="operator-gt-eq"></a>operator>= ( const <a href="ntqstring.html">TQString</a> & s1, const char * s2 )
</h3>
<p>
<p> Returns TRUE if <em>s1</em> is lexically greater than or equal to <em>s2</em>;
otherwise returns FALSE.
The comparison is case sensitive.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) >= 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn>bool <a name="operator-gt-eq-2"></a>operator>= ( const char * s1, const <a href="ntqstring.html">TQString</a> & s2 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
<p> Returns TRUE if <em>s1</em> is lexically greater than or equal to <em>s2</em>;
otherwise returns FALSE.
The comparison is case sensitive.
Note that a null string is not equal to a not-null empty string.
<p> Equivalent to <a href="#compare">compare</a>(<em>s1</em>, <em>s2</em>) >= 0.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isEmpty">isEmpty</a>().
<h3 class=fn><a href="ntqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="ntqdatastream.html">TQDataStream</a> & s, <a href="ntqstring.html">TQString</a> & str )
</h3>
<p> Reads a string from the stream <em>s</em> into string <em>str</em>.
<p> See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|