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
|
<HTML>
<head><title>wxString</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxstring"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx223.htm#wxstreambuffer"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx225.htm#wxstringlist"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxString</H2>
<P>
wxString is a class representing a character string. Please see the
<A HREF="wx280.htm#wxstringoverview">wxString overview</A> for more information about it. As explained
there, wxString implements about 90% of methods of the std::string class (iterators
are not supported, nor all methods which use them).
These standard functions are not documented in this manual so please see the STL documentation.
The behaviour of all these functions is identical to the behaviour described
there.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
None<P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/string.h><P>
<B><FONT COLOR="#FF0000">Predefined objects</FONT></B><P>
Objects:<P>
<B>wxEmptyString</B><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx280.htm#wxstringoverview">Overview</A><P>
<B><FONT COLOR="#FF0000">Function groups</FONT></B><P>
<A HREF="#topic868">Constructors and assignment operators</A><BR>
<A HREF="#topic869">String length</A><BR>
<A HREF="#topic870">Character access</A><BR>
<A HREF="#topic871">Concatenation</A><BR>
<A HREF="#topic872">Comparison</A><BR>
<A HREF="#topic873">Substring extraction</A><BR>
<A HREF="#topic874">Case conversion</A><BR>
<A HREF="#topic875">Searching and replacing</A><BR>
<A HREF="#topic876">Writing values into the string</A><BR>
<A HREF="#topic877">Memory management</A><BR>
<A HREF="#topic878">Miscellaneous</A><BR>
<A HREF="#topic879">wxWindows 1.xx compatiblity functions</A><BR>
<A HREF="#wxstringat">std::string compatibility functions</A><BR>
<A HREF="#wxstringconstruct">wxString::wxString</A><BR>
<A HREF="#wxstringdestruct">wxString::~wxString</A><BR>
<A HREF="#wxstringalloc">wxString::Alloc</A><BR>
<A HREF="#wxstringappend">wxString::Append</A><BR>
<A HREF="#wxstringafterfirst">wxString::AfterFirst</A><BR>
<A HREF="#wxstringafterlast">wxString::AfterLast</A><BR>
<A HREF="#wxstringbeforefirst">wxString::BeforeFirst</A><BR>
<A HREF="#wxstringbeforelast">wxString::BeforeLast</A><BR>
<A HREF="#wxstringcstr">wxString::c_str</A><BR>
<A HREF="#wxstringclear">wxString::Clear</A><BR>
<A HREF="#wxstringcmp">wxString::Cmp</A><BR>
<A HREF="#wxstringcmpnocase">wxString::CmpNoCase</A><BR>
<A HREF="#wxstringcompareto">wxString::CompareTo</A><BR>
<A HREF="#wxstringcontains">wxString::Contains</A><BR>
<A HREF="#wxstringempty">wxString::Empty</A><BR>
<A HREF="#wxstringfind">wxString::Find</A><BR>
<A HREF="#wxstringfirst">wxString::First</A><BR>
<A HREF="#wxstringfreq">wxString::Freq</A><BR>
<A HREF="#wxstringgetchar">wxString::GetChar</A><BR>
<A HREF="#wxstringgetdata">wxString::GetData</A><BR>
<A HREF="#wxstringgetwritablechar">wxString::GetWritableChar</A><BR>
<A HREF="#wxstringgetwritebuf">wxString::GetWriteBuf</A><BR>
<A HREF="#wxstringindex">wxString::Index</A><BR>
<A HREF="#wxstringisascii">wxString::IsAscii</A><BR>
<A HREF="#wxstringisempty">wxString::IsEmpty</A><BR>
<A HREF="#wxstringisnull">wxString::IsNull</A><BR>
<A HREF="#wxstringisnumber">wxString::IsNumber</A><BR>
<A HREF="#wxstringissameas">wxString::IsSameAs</A><BR>
<A HREF="#wxstringisword">wxString::IsWord</A><BR>
<A HREF="#wxstringlast">wxString::Last</A><BR>
<A HREF="#wxstringleft">wxString::Left</A><BR>
<A HREF="#wxstringlen">wxString::Len</A><BR>
<A HREF="#wxstringlength">wxString::Length</A><BR>
<A HREF="#wxstringlower">wxString::Lower</A><BR>
<A HREF="#wxstringlowercase">wxString::LowerCase</A><BR>
<A HREF="#wxstringmakelower">wxString::MakeLower</A><BR>
<A HREF="#wxstringmakeupper">wxString::MakeUpper</A><BR>
<A HREF="#wxstringmatches">wxString::Matches</A><BR>
<A HREF="#wxstringmid">wxString::Mid</A><BR>
<A HREF="#wxstringpad">wxString::Pad</A><BR>
<A HREF="#wxstringprepend">wxString::Prepend</A><BR>
<A HREF="#wxstringprintf">wxString::Printf</A><BR>
<A HREF="#wxstringprintfv">wxString::PrintfV</A><BR>
<A HREF="#wxstringremove">wxString::Remove</A><BR>
<A HREF="#wxstringremovelast">wxString::RemoveLast</A><BR>
<A HREF="#wxstringreplace">wxString::Replace</A><BR>
<A HREF="#wxstringright">wxString::Right</A><BR>
<A HREF="#wxstringsetchar">wxString::SetChar</A><BR>
<A HREF="#wxstringshrink">wxString::Shrink</A><BR>
<A HREF="#wxstringsprintf">wxString::sprintf</A><BR>
<A HREF="#wxstringstrip">wxString::Strip</A><BR>
<A HREF="#wxstringsubstring">wxString::SubString</A><BR>
<A HREF="#wxstringtrim">wxString::Trim</A><BR>
<A HREF="#wxstringtruncate">wxString::Truncate</A><BR>
<A HREF="#wxstringungetwritebuf">wxString::UngetWriteBuf</A><BR>
<A HREF="#wxstringupper">wxString::Upper</A><BR>
<A HREF="#wxstringuppercase">wxString::UpperCase</A><BR>
<A HREF="#wxstringoperatornot">wxString::operator!</A><BR>
<A HREF="#wxstringoperatorassign">wxString::operator =</A><BR>
<A HREF="#wxstringoperatorplus">operator wxString::+</A><BR>
<A HREF="#wxstringplusequal">wxString::operator +=</A><BR>
<A HREF="#wxstringoperatorbracket">wxString::operator []</A><BR>
<A HREF="#wxstringoperatorparenth">wxString::operator ()</A><BR>
<A HREF="#wxstringoperatorout">wxString::operator <<</A><BR>
<A HREF="#wxstringoperatorin">wxString::operator >></A><BR>
<A HREF="#wxstringoperatorconstcharpt">wxString::operator const char*</A><BR>
<A HREF="#wxstringcomparison">Comparison operators</A><BR>
<P>
<HR>
<A NAME="topic868"></A>
<H3>Constructors and assignment operators</H3>
<P>
A strign may be constructed either from a C string, (some number of copies of)
a single character or a wide (UNICODE) string. For all constructors (except the
default which creates an empty string) there is also a corresponding assignment
operator.<P>
<A HREF="wx224.htm#wxstringconstruct">wxString</A><BR>
<A HREF="wx224.htm#wxstringoperatorassign">operator =</A><BR>
<A HREF="wx224.htm#wxstringdestruct">~wxString</A><P>
<HR>
<A NAME="topic869"></A>
<H3>String length</H3>
<P>
These functions return the string length and check whether the string is empty
or empty it.<P>
<A HREF="wx224.htm#wxstringlen">Len</A><BR>
<A HREF="wx224.htm#wxstringisempty">IsEmpty</A><BR>
<A HREF="wx224.htm#wxstringoperatornot">operator!</A><BR>
<A HREF="wx224.htm#wxstringempty">Empty</A><BR>
<A HREF="wx224.htm#wxstringclear">Clear</A><P>
<HR>
<A NAME="topic870"></A>
<H3>Character access</H3>
<P>
Many functions in this section take a character index in the string. As with C
strings and/or arrays, the indices start from 0, so the first character of a
string is string[0]. Attempt to access a character beyond the end of the
string (which may be even 0 if the string is empty) will provocate an assert
failure in <A HREF="wx295.htm#debuggingoverview">debug build</A>, but no checks are done in
release builds.<P>
This section also contains both implicit and explicit conversions to C style
strings. Although implicit conversion is quite convenient, it is advised to use
explicit <A HREF="wx224.htm#wxstringcstr">c_str()</A> method for the sake of clarity. Also
see <A HREF="wx280.htm#wxstringadvices">overview</A> for the cases where it is necessary to
use it.<P>
<A HREF="wx224.htm#wxstringgetchar">GetChar</A><BR>
<A HREF="wx224.htm#wxstringgetwritablechar">GetWritableChar</A><BR>
<A HREF="wx224.htm#wxstringsetchar">SetChar</A><BR>
<A HREF="wx224.htm#wxstringlast">Last</A><BR>
<A HREF="wx224.htm#wxstringoperatorbracket">operator []</A><BR>
<A HREF="wx224.htm#wxstringcstr">c_str</A><BR>
<A HREF="wx224.htm#wxstringoperatorconstcharpt">operator const char*</A><P>
<HR>
<A NAME="topic871"></A>
<H3>Concatenation</H3>
<P>
Anything may be concatenated (appended to) with a string. However, you can't
append something to a C string (including literal constants), so to do this it
should be converted to a wxString first.<P>
<A HREF="wx224.htm#wxstringoperatorout">operator <<</A><BR>
<A HREF="wx224.htm#wxstringplusequal">operator +=</A><BR>
<A HREF="wx224.htm#wxstringoperatorplus">operator +</A><BR>
<A HREF="wx224.htm#wxstringappend">Append</A><BR>
<A HREF="wx224.htm#wxstringprepend">Prepend</A><P>
<HR>
<A NAME="topic872"></A>
<H3>Comparison</H3>
<P>
The default comparison function <A HREF="wx224.htm#wxstringcmp">Cmp</A> is case-sensitive and
so is the default version of <A HREF="wx224.htm#wxstringissameas">IsSameAs</A>. For case
insensitive comparisons you should use <A HREF="wx224.htm#wxstringcmpnocase">CmpNoCase</A> or
give a second parameter to IsSameAs. This last function is may be more
convenient if only equality of the strings matters because it returns a boolean
true value if the strings are the same and not 0 (which is usually FALSE in C)
as Cmp does.<P>
<A HREF="wx224.htm#wxstringmatches">Matches</A> is a poor man's regular expression matcher:
it only understands '*' and '?' metacharacters in the sense of DOS command line
interpreter.<P>
<A HREF="wx224.htm#wxstringcmp">Cmp</A><BR>
<A HREF="wx224.htm#wxstringcmpnocase">CmpNoCase</A><BR>
<A HREF="wx224.htm#wxstringissameas">IsSameAs</A><BR>
<A HREF="wx224.htm#wxstringmatches">Matches</A><P>
<HR>
<A NAME="topic873"></A>
<H3>Substring extraction</H3>
<P>
These functions allow to extract substring from this string. All of them don't
modify the original string and return a new string containing the extracted
substring.<P>
<A HREF="wx224.htm#wxstringmid">Mid</A><BR>
<A HREF="wx224.htm#wxstringoperatorparenth">operator()</A><BR>
<A HREF="wx224.htm#wxstringleft">Left</A><BR>
<A HREF="wx224.htm#wxstringright">Right</A><BR>
<A HREF="wx224.htm#wxstringbeforefirst">BeforeFirst</A><BR>
<A HREF="wx224.htm#wxstringbeforelast">BeforeLast</A><BR>
<A HREF="wx224.htm#wxstringafterfirst">AfterFirst</A><BR>
<A HREF="wx224.htm#wxstringafterlast">AfterLast</A><P>
<HR>
<A NAME="topic874"></A>
<H3>Case conversion</H3>
<P>
The MakeXXX() variants modify the string in place, while the other functions
return a new string which containts the original text converted to the upper or
lower case and leave the original string unchanged.<P>
<A HREF="wx224.htm#wxstringmakeupper">MakeUpper</A><BR>
<A HREF="wx224.htm#wxstringupper">Upper</A><BR>
<A HREF="wx224.htm#wxstringmakelower">MakeLower</A><BR>
<A HREF="wx224.htm#wxstringlower">Lower</A><P>
<HR>
<A NAME="topic875"></A>
<H3>Searching and replacing</H3>
<P>
These functions replace the standard <I>strchr()</I> and <I>strstr()</I>
functions.<P>
<A HREF="wx224.htm#wxstringfind">Find</A><BR>
<A HREF="wx224.htm#wxstringreplace">Replace</A><P>
<HR>
<A NAME="topic876"></A>
<H3>Writing values into the string</H3>
<P>
Both formatted versions (<A HREF="wx224.htm#wxstringprintf">Printf</A>) and stream-like
insertion operators exist (for basic types only).<P>
<A HREF="wx224.htm#wxstringprintf">Printf</A><BR>
<A HREF="wx224.htm#wxstringprintfv">PrintfV</A><BR>
<A HREF="wx224.htm#wxstringoperatorout">operator <<</A><P>
<HR>
<A NAME="topic877"></A>
<H3>Memory management</H3>
<P>
These are "advanced" functions and they will be needed quite rarily.
<A HREF="wx224.htm#wxstringalloc">Alloc</A> and <A HREF="wx224.htm#wxstringshrink">Shrink</A> are only
interesting for optimization purposes.
<A HREF="wx224.htm#wxstringgetwritebuf">GetWriteBuf</A> may be very useful when working with
some external API which requires the caller to provide a writable buffer, but
extreme care should be taken when using it: before performing any other
operation on the string <A HREF="wx224.htm#wxstringungetwritebuf">UngetWriteBuf</A> <B>
must</B> be called!<P>
<A HREF="wx224.htm#wxstringalloc">Alloc</A><BR>
<A HREF="wx224.htm#wxstringshrink">Shrink</A><BR>
<A HREF="wx224.htm#wxstringgetwritebuf">GetWriteBuf</A><BR>
<A HREF="wx224.htm#wxstringungetwritebuf">UngetWriteBuf</A><P>
<HR>
<A NAME="topic878"></A>
<H3>Miscellaneous</H3>
<P>
Other string functions.<P>
<A HREF="wx224.htm#wxstringtrim">Trim</A><BR>
<A HREF="wx224.htm#wxstringpad">Pad</A><BR>
<A HREF="wx224.htm#wxstringtruncate">Truncate</A><P>
<HR>
<A NAME="topic879"></A>
<H3>wxWindows 1.xx compatiblity functions</H3>
<P>
These functiosn are deprecated, please consider using new wxWindows 2.0
functions instead of them (or, even better, std::string compatible variants).<P>
<A HREF="wx224.htm#wxstringsubstring">SubString</A><BR>
<A HREF="wx224.htm#wxstringsprintf">sprintf</A><BR>
<A HREF="wx224.htm#wxstringcompareto">CompareTo</A><BR>
<A HREF="wx224.htm#wxstringlength">Length</A><BR>
<A HREF="wx224.htm#wxstringfreq">Freq</A><BR>
<A HREF="wx224.htm#wxstringlowercase">LowerCase</A><BR>
<A HREF="wx224.htm#wxstringuppercase">UpperCase</A><BR>
<A HREF="wx224.htm#wxstringstrip">Strip</A><BR>
<A HREF="wx224.htm#wxstringindex">Index</A><BR>
<A HREF="wx224.htm#wxstringremove">Remove</A><BR>
<A HREF="wx224.htm#wxstringfirst">First</A><BR>
<A HREF="wx224.htm#wxstringlast">Last</A><BR>
<A HREF="wx224.htm#wxstringcontains">Contains</A><BR>
<A HREF="wx224.htm#wxstringisnull">IsNull</A><BR>
<A HREF="wx224.htm#wxstringisascii">IsAscii</A><BR>
<A HREF="wx224.htm#wxstringisnumber">IsNumber</A><BR>
<A HREF="wx224.htm#wxstringisword">IsWord</A><P>
<HR>
<A NAME="wxstringat"></A>
<H3>std::string compatibility functions</H3>
<P>
The supported functions are only listed here, please see any STL reference for
their documentation.<P>
<PRE>
// take nLen chars starting at nPos
wxString(const wxString& str, size_t nPos, size_t nLen);
// take all characters from pStart to pEnd (poor man's iterators)
wxString(const void *pStart, const void *pEnd);
// lib.string.capacity
// return the length of the string
size_t size() const;
// return the length of the string
size_t length() const;
// return the maximum size of the string
size_t max_size() const;
// resize the string, filling the space with c if c != 0
void resize(size_t nSize, char ch = '\0');
// delete the contents of the string
void clear();
// returns true if the string is empty
bool empty() const;
// lib.string.access
// return the character at position n
char at(size_t n) const;
// returns the writable character at position n
char& at(size_t n);
// lib.string.modifiers
// append a string
wxString& append(const wxString& str);
// append elements str[pos], ..., str[pos+n]
wxString& append(const wxString& str, size_t pos, size_t n);
// append first n (or all if n == npos) characters of sz
wxString& append(const char *sz, size_t n = npos);
// append n copies of ch
wxString& append(size_t n, char ch);
// same as `this_string = str'
wxString& assign(const wxString& str);
// same as ` = str[pos..pos + n]
wxString& assign(const wxString& str, size_t pos, size_t n);
// same as `= first n (or all if n == npos) characters of sz'
wxString& assign(const char *sz, size_t n = npos);
// same as `= n copies of ch'
wxString& assign(size_t n, char ch);
// insert another string
wxString& insert(size_t nPos, const wxString& str);
// insert n chars of str starting at nStart (in str)
wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n);
// insert first n (or all if n == npos) characters of sz
wxString& insert(size_t nPos, const char *sz, size_t n = npos);
// insert n copies of ch
wxString& insert(size_t nPos, size_t n, char ch);
// delete characters from nStart to nStart + nLen
wxString& erase(size_t nStart = 0, size_t nLen = npos);
// replaces the substring of length nLen starting at nStart
wxString& replace(size_t nStart, size_t nLen, const char* sz);
// replaces the substring with nCount copies of ch
wxString& replace(size_t nStart, size_t nLen, size_t nCount, char ch);
// replaces a substring with another substring
wxString& replace(size_t nStart, size_t nLen,
const wxString& str, size_t nStart2, size_t nLen2);
// replaces the substring with first nCount chars of sz
wxString& replace(size_t nStart, size_t nLen,
const char* sz, size_t nCount);
// swap two strings
void swap(wxString& str);
// All find() functions take the nStart argument which specifies the
// position to start the search on, the default value is 0. All functions
// return npos if there were no match.
// find a substring
size_t find(const wxString& str, size_t nStart = 0) const;
// find first n characters of sz
size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const;
// find the first occurence of character ch after nStart
size_t find(char ch, size_t nStart = 0) const;
// rfind() family is exactly like find() but works right to left
// as find, but from the end
size_t rfind(const wxString& str, size_t nStart = npos) const;
// as find, but from the end
size_t rfind(const char* sz, size_t nStart = npos,
size_t n = npos) const;
// as find, but from the end
size_t rfind(char ch, size_t nStart = npos) const;
// find first/last occurence of any character in the set
//
size_t find_first_of(const wxString& str, size_t nStart = 0) const;
//
size_t find_first_of(const char* sz, size_t nStart = 0) const;
// same as find(char, size_t)
size_t find_first_of(char c, size_t nStart = 0) const;
//
size_t find_last_of (const wxString& str, size_t nStart = npos) const;
//
size_t find_last_of (const char* s, size_t nStart = npos) const;
// same as rfind(char, size_t)
size_t find_last_of (char c, size_t nStart = npos) const;
// find first/last occurence of any character not in the set
//
size_t find_first_not_of(const wxString& str, size_t nStart = 0) const;
//
size_t find_first_not_of(const char* s, size_t nStart = 0) const;
//
size_t find_first_not_of(char ch, size_t nStart = 0) const;
//
size_t find_last_not_of(const wxString& str, size_t nStart=npos) const;
//
size_t find_last_not_of(const char* s, size_t nStart = npos) const;
//
size_t find_last_not_of(char ch, size_t nStart = npos) const;
// All compare functions return a negative, zero or positive value
// if the [sub]string is less, equal or greater than the compare() argument.
// just like strcmp()
int compare(const wxString& str) const;
// comparison with a substring
int compare(size_t nStart, size_t nLen, const wxString& str) const;
// comparison of 2 substrings
int compare(size_t nStart, size_t nLen,
const wxString& str, size_t nStart2, size_t nLen2) const;
// just like strcmp()
int compare(const char* sz) const;
// substring comparison with first nCount characters of sz
int compare(size_t nStart, size_t nLen,
const char* sz, size_t nCount = npos) const;
// substring extraction
wxString substr(size_t nStart = 0, size_t nLen = npos) const;
</PRE>
<P>
<HR>
<A NAME="wxstringconstruct"></A>
<H3>wxString::wxString</H3>
<P>
<B></B> <B>wxString</B>()<P>
Default constructor.<P>
<B></B> <B>wxString</B>(<B>const wxString&</B><I> x</I>)<P>
Copy constructor.<P>
<B></B> <B>wxString</B>(<B>char</B><I> ch</I>, <B>size_t</B><I> n = 1</I>)<P>
Constructs a string of <I>n</I> copies of character <I>ch</I>.<P>
<B></B> <B>wxString</B>(<B>const char*</B><I> psz</I>, <B>size_t</B><I> nLength = wxSTRING_MAXLEN</I>)<P>
Takes first <I>nLength</I> characters from the C string <I>psz</I>.
The default value of wxSTRING_MAXLEN means take all the string.<P>
<B></B> <B>wxString</B>(<B>const unsigned char*</B><I> psz</I>, <B>size_t</B><I> nLength = wxSTRING_MAXLEN</I>)<P>
For compilers using unsigned char: takes first <I>nLength</I> characters from the C string <I>psz</I>.
The default value of wxSTRING_MAXLEN means take all the string.<P>
<B></B> <B>wxString</B>(<B>const wchar_t*</B><I> psz</I>)<P>
Constructs a string from the wide (UNICODE) string.<P>
<HR>
<A NAME="wxstringdestruct"></A>
<H3>wxString::~wxString</H3>
<P>
<B></B> <B>~wxString</B>()<P>
String destructor. Note that this is not virtual, so wxString must not be inherited from.<P>
<HR>
<A NAME="wxstringalloc"></A>
<H3>wxString::Alloc</H3>
<P>
<B>void</B> <B>Alloc</B>(<B>size_t</B><I> nLen</I>)<P>
Preallocate enough space for wxString to store <I>nLen</I> characters. This function
may be used to increase speed when the string is constructed by repeated
concatenation as in<P>
<PRE>
// delete all vowels from the string
wxString DeleteAllVowels(const wxString& original)
{
wxString result;
size_t len = original.length();
result.Alloc(len);
for ( size_t n = 0; n < len; n++ )
{
if ( strchr("aeuio", tolower(original[n])) == NULL )
result += original[n];
}
return result;
}
</PRE>
because it will avoid the need of reallocating string memory many times (in case
of long strings). Note that it does not set the maximal length of a string - it
will still expand if more than <I>nLen</I> characters are stored in it. Also, it
does not truncate the existing string (use
<A HREF="wx224.htm#wxstringtruncate">Truncate()</A> for this) even if its current length is
greater than <I>nLen</I><P>
<HR>
<A NAME="wxstringappend"></A>
<H3>wxString::Append</H3>
<P>
<B>wxString&</B> <B>Append</B>(<B>const char*</B><I> psz</I>)<P>
Concatenates <I>psz</I> to this string, returning a reference to it.<P>
<B>wxString&</B> <B>Append</B>(<B>char</B><I> ch</I>, <B>int</B><I> count = 1</I>)<P>
Concatenates character <I>ch</I> to this string, <I>count</I> times, returning a reference
to it.<P>
<HR>
<A NAME="wxstringafterfirst"></A>
<H3>wxString::AfterFirst</H3>
<P>
<B>wxString</B> <B>AfterFirst</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Gets all the characters after the first occurence of <I>ch</I>.
Returns the empty string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringafterlast"></A>
<H3>wxString::AfterLast</H3>
<P>
<B>wxString</B> <B>AfterLast</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Gets all the characters after the last occurence of <I>ch</I>.
Returns the whole string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringbeforefirst"></A>
<H3>wxString::BeforeFirst</H3>
<P>
<B>wxString</B> <B>BeforeFirst</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Gets all characters before the first occurence of <I>ch</I>.
Returns the whole string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringbeforelast"></A>
<H3>wxString::BeforeLast</H3>
<P>
<B>wxString</B> <B>BeforeLast</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Gets all characters before the last occurence of <I>ch</I>.
Returns the empty string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringcstr"></A>
<H3>wxString::c_str</H3>
<P>
<B>const char *</B> <B>c_str</B>() <B>const</B><P>
Returns a pointer to the string data.<P>
<HR>
<A NAME="wxstringclear"></A>
<H3>wxString::Clear</H3>
<P>
<B>void</B> <B>Clear</B>()<P>
Empties the string and frees memory occupied by it.<P>
See also: <A HREF="wx224.htm#wxstringempty">Empty</A><P>
<HR>
<A NAME="wxstringcmp"></A>
<H3>wxString::Cmp</H3>
<P>
<B>int</B> <B>Cmp</B>(<B>const char*</B><I> psz</I>) <B>const</B><P>
Case-sensitive comparison.<P>
Returns a positive value if the string is greater than the argument, zero if
it si equal to it or negative value if it is less than argument (same semantics
as the standard <I>strcmp()</I> function).<P>
See also <A HREF="wx224.htm#wxstringcmpnocase">CmpNoCase</A>, <A HREF="wx224.htm#wxstringissameas">IsSameAs</A>.<P>
<HR>
<A NAME="wxstringcmpnocase"></A>
<H3>wxString::CmpNoCase</H3>
<P>
<B>int</B> <B>CmpNoCase</B>(<B>const char*</B><I> psz</I>) <B>const</B><P>
Case-insensitive comparison.<P>
Returns a positive value if the string is greater than the argument, zero if
it si equal to it or negative value if it is less than argument (same semantics
as the standard <I>strcmp()</I> function).<P>
See also <A HREF="wx224.htm#wxstringcmp">Cmp</A>, <A HREF="wx224.htm#wxstringissameas">IsSameAs</A>.<P>
<HR>
<A NAME="wxstringcompareto"></A>
<H3>wxString::CompareTo</H3>
<P>
<PRE>
#define NO_POS ((int)(-1)) // undefined position
enum caseCompare {exact, ignoreCase};
</PRE>
<B>int</B> <B>CompareTo</B>(<B>const char*</B><I> psz</I>, <B>caseCompare</B><I> cmp = exact</I>) <B>const</B><P>
Case-sensitive comparison. Returns 0 if equal, 1 if greater or -1 if less.<P>
<HR>
<A NAME="wxstringcontains"></A>
<H3>wxString::Contains</H3>
<P>
<B>bool</B> <B>Contains</B>(<B>const wxString&</B><I> str</I>) <B>const</B><P>
Returns 1 if target appears anyhere in wxString; else 0.<P>
<HR>
<A NAME="wxstringempty"></A>
<H3>wxString::Empty</H3>
<P>
<B>void</B> <B>Empty</B>()<P>
Makes the string empty, but doesn't free memory occupied by the string.<P>
See also: <A HREF="wx224.htm#wxstringclear">Clear()</A>.<P>
<HR>
<A NAME="wxstringfind"></A>
<H3>wxString::Find</H3>
<P>
<B>int</B> <B>Find</B>(<B>char</B><I> ch</I>, <B>bool</B><I> fromEnd = FALSE</I>) <B>const</B><P>
Searches for the given character. Returns the starting index, or -1 if not found.<P>
<B>int</B> <B>Find</B>(<B>const char*</B><I> sz</I>) <B>const</B><P>
Searches for the given string. Returns the starting index, or -1 if not found.<P>
<HR>
<A NAME="wxstringfirst"></A>
<H3>wxString::First</H3>
<P>
<B>size_t</B> <B>First</B>(<B>char</B><I> c</I>)<P>
<B>size_t</B> <B>First</B>(<B>const char*</B><I> psz</I>) <B>const</B><P>
<B>size_t</B> <B>First</B>(<B>const wxString&</B><I> str</I>) <B>const</B><P>
<B>size_t</B> <B>First</B>(<B>const char</B><I> ch</I>) <B>const</B><P>
Returns the first occurrence of the item.<P>
<HR>
<A NAME="wxstringfreq"></A>
<H3>wxString::Freq</H3>
<P>
<B>int</B> <B>Frec</B>(<B>char </B><I>ch</I>) <B>const</B><P>
Returns the number of occurences of it ch in the string.<P>
<HR>
<A NAME="wxstringgetchar"></A>
<H3>wxString::GetChar</H3>
<P>
<B>char</B> <B>GetChar</B>(<B>size_t</B><I> n</I>) <B>const</B><P>
Returns the character at position <I>n</I> (read-only).<P>
<HR>
<A NAME="wxstringgetdata"></A>
<H3>wxString::GetData</H3>
<P>
<B>const char*</B> <B>GetData</B>() <B>const</B><P>
wxWindows compatibility conversion. Returns a constant pointer to the data in the string.<P>
<HR>
<A NAME="wxstringgetwritablechar"></A>
<H3>wxString::GetWritableChar</H3>
<P>
<B>char&</B> <B>GetWritableChar</B>(<B>size_t</B><I> n</I>)<P>
Returns a reference to the character at position <I>n</I>.<P>
<HR>
<A NAME="wxstringgetwritebuf"></A>
<H3>wxString::GetWriteBuf</H3>
<P>
<B>char*</B> <B>GetWriteBuf</B>(<B>size_t</B><I> len</I>)<P>
Returns a writable buffer of at least <I>len</I> bytes.<P>
Call <A HREF="wx224.htm#wxstringungetwritebuf">wxString::UngetWriteBuf</A> as soon as possible
to put the string back into a reasonable state.<P>
<HR>
<A NAME="wxstringindex"></A>
<H3>wxString::Index</H3>
<P>
<B>size_t</B> <B>Index</B>(<B>char</B><I> ch</I>, <B>int</B><I> startpos = 0</I>) <B>const</B><P>
Same as <A HREF="wx224.htm#wxstringfind">wxString::Find</A>.<P>
<B>size_t</B> <B>Index</B>(<B>const char*</B><I> sz</I>) <B>const</B><P>
Same as <A HREF="wx224.htm#wxstringfind">wxString::Find</A>.<P>
<B>size_t</B> <B>Index</B>(<B>const char*</B><I> sz</I>, <B>bool</B><I> caseSensitive = TRUE</I>, <B>bool</B><I> fromEnd = FALSE</I>) <B>const</B><P>
Search the element in the array, starting from either side.<P>
If <I>fromEnd</I> is TRUE, reverse search direction.<P>
If <B>caseSensitive</B>, comparison is case sensitive (the default).<P>
Returns the index of the first item matched, or NOT_FOUND.<P>
<HR>
<A NAME="wxstringisascii"></A>
<H3>wxString::IsAscii</H3>
<P>
<B>bool</B> <B>IsAscii</B>() <B>const</B><P>
Returns TRUE if the string is ASCII.<P>
<HR>
<A NAME="wxstringisempty"></A>
<H3>wxString::IsEmpty</H3>
<P>
<B>bool</B> <B>IsEmpty</B>() <B>const</B><P>
Returns TRUE if the string is NULL.<P>
<HR>
<A NAME="wxstringisnull"></A>
<H3>wxString::IsNull</H3>
<P>
<B>bool</B> <B>IsNull</B>() <B>const</B><P>
Returns TRUE if the string is NULL (same as IsEmpty).<P>
<HR>
<A NAME="wxstringisnumber"></A>
<H3>wxString::IsNumber</H3>
<P>
<B>bool</B> <B>IsNumber</B>() <B>const</B><P>
Returns TRUE if the string is a number.<P>
<HR>
<A NAME="wxstringissameas"></A>
<H3>wxString::IsSameAs</H3>
<P>
<B>bool</B> <B>IsSameAs</B>(<B>const char*</B><I> psz</I>, <B>bool</B><I> caseSensitive = TRUE</I>) <B>const</B><P>
Test for string equality, case-sensitive (default) or not.<P>
caseSensitive is TRUE by default (case matters).<P>
Returns TRUE if strings are equal, FALSE otherwise.<P>
See also <A HREF="wx224.htm#wxstringcmp">Cmp</A>, <A HREF="wx224.htm#wxstringcmpnocase">CmpNoCase</A>.<P>
<HR>
<A NAME="wxstringisword"></A>
<H3>wxString::IsWord</H3>
<P>
<B>bool</B> <B>IsWord</B>() <B>const</B><P>
Returns TRUE if the string is a word. TODO: what's the definition of a word?<P>
<HR>
<A NAME="wxstringlast"></A>
<H3>wxString::Last</H3>
<P>
<B>char</B> <B>Last</B>() <B>const</B><P>
Returns the last character.<P>
<B>char&</B> <B>Last</B>()<P>
Returns a reference to the last character (writable).<P>
<HR>
<A NAME="wxstringleft"></A>
<H3>wxString::Left</H3>
<P>
<B>wxString</B> <B>Left</B>(<B>size_t</B><I> count</I>) <B>const</B><P>
Returns the first <I>count</I> characters.<P>
<B>wxString</B> <B>Left</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Returns all characters before the first occurence of <I>ch</I>.
Returns the whole string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringlen"></A>
<H3>wxString::Len</H3>
<P>
<B>size_t</B> <B>Len</B>() <B>const</B><P>
Returns the length of the string.<P>
<HR>
<A NAME="wxstringlength"></A>
<H3>wxString::Length</H3>
<P>
<B>size_t</B> <B>Length</B>() <B>const</B><P>
Returns the length of the string (same as Len).<P>
<HR>
<A NAME="wxstringlower"></A>
<H3>wxString::Lower</H3>
<P>
<B>wxString</B> <B>Lower</B>() <B>const</B><P>
Returns this string converted to the lower case.<P>
<HR>
<A NAME="wxstringlowercase"></A>
<H3>wxString::LowerCase</H3>
<P>
<B>void</B> <B>LowerCase</B>()<P>
Same as MakeLower.<P>
<HR>
<A NAME="wxstringmakelower"></A>
<H3>wxString::MakeLower</H3>
<P>
<B>void</B> <B>MakeLower</B>()<P>
Converts all characters to lower case.<P>
<HR>
<A NAME="wxstringmakeupper"></A>
<H3>wxString::MakeUpper</H3>
<P>
<B>void</B> <B>MakeUpper</B>()<P>
Converts all characters to upper case.<P>
<HR>
<A NAME="wxstringmatches"></A>
<H3>wxString::Matches</H3>
<P>
<B>bool</B> <B>Matches</B>(<B>const char*</B><I> szMask</I>) <B>const</B><P>
Returns TRUE if the string contents matches a mask containing '*' and '?'.<P>
<HR>
<A NAME="wxstringmid"></A>
<H3>wxString::Mid</H3>
<P>
<B>wxString</B> <B>Mid</B>(<B>size_t</B><I> first</I>, <B>size_t</B><I> count = wxSTRING_MAXLEN</I>) <B>const</B><P>
Returns a substring starting at <I>first</I>, with length <I>count</I>, or the rest of
the string if <I>count</I> is the default value.<P>
<HR>
<A NAME="wxstringpad"></A>
<H3>wxString::Pad</H3>
<P>
<B>wxString&</B> <B>Pad</B>(<B>size_t</B><I> count</I>, <B>char</B><I> pad = ' '</I>, <B>bool</B><I> fromRight = TRUE</I>)<P>
Adds <I>count</I> copies of <I>pad</I> to the beginning, or to the end of the string (the default).<P>
Removes spaces from the left or from the right (default).<P>
<HR>
<A NAME="wxstringprepend"></A>
<H3>wxString::Prepend</H3>
<P>
<B>wxString&</B> <B>Prepend</B>(<B>const wxString&</B><I> str</I>)<P>
Prepends <I>str</I> to this string, returning a reference to this string.<P>
<HR>
<A NAME="wxstringprintf"></A>
<H3>wxString::Printf</H3>
<P>
<B>int</B> <B>Printf</B>(<B>const char* </B><I>pszFormat</I>, <B></B><I>...</I>)<P>
Similar to the standard function <I>sprintf()</I>. Returns the number of
characters written, or an integer less than zero on error.<P>
<B>NB:</B> This function will use a safe version of <I>vsprintf()</I> (usually called
<I>vsnprintf()</I>) whenever available to always allocate the buffer of correct
size. Unfortunately, this function is not available on all platforms and the
dangerous <I>vsprintf()</I> will be used then which may lead to buffer overflows.<P>
<HR>
<A NAME="wxstringprintfv"></A>
<H3>wxString::PrintfV</H3>
<P>
<B>int</B> <B>PrintfV</B>(<B>const char* </B><I>pszFormat</I>, <B>va_list</B><I> argPtr</I>)<P>
Similar to vprintf. Returns the number of characters written, or an integer less than zero
on error.<P>
<HR>
<A NAME="wxstringremove"></A>
<H3>wxString::Remove</H3>
<P>
<B>wxString&</B> <B>Remove</B>(<B>size_t</B><I> pos</I>)<P>
Same as Truncate. Removes the portion from <I>pos</I> to the end of the string.<P>
<B>wxString&</B> <B>Remove</B>(<B>size_t</B><I> pos</I>, <B>size_t</B><I> len</I>)<P>
Removes the last <I>len</I> characters from the string, starting at <I>pos</I>.<P>
<HR>
<A NAME="wxstringremovelast"></A>
<H3>wxString::RemoveLast</H3>
<P>
<B>wxString&</B> <B>RemoveLast</B>()<P>
Removes the last character.<P>
<HR>
<A NAME="wxstringreplace"></A>
<H3>wxString::Replace</H3>
<P>
<B>size_t</B> <B>Replace</B>(<B>const char*</B><I> szOld</I>, <B>const char*</B><I> szNew</I>, <B>bool</B><I> replaceAll = TRUE</I>)<P>
Replace first (or all) occurences of substring with another one.<P>
<I>replaceAll</I>: global replace (default), or only the first occurence.<P>
Returns the number of replacements made.<P>
<HR>
<A NAME="wxstringright"></A>
<H3>wxString::Right</H3>
<P>
<B>wxString</B> <B>Right</B>(<B>size_t</B><I> count</I>) <B>const</B><P>
Returns the last <I>count</I> characters.<P>
<B>wxString</B> <B>Right</B>(<B>char</B><I> ch</I>) <B>const</B><P>
Returns all characters after the last occurence of <I>ch</I>.
Returns the whole string if <I>ch</I> is not found.<P>
<HR>
<A NAME="wxstringsetchar"></A>
<H3>wxString::SetChar</H3>
<P>
<B>void</B> <B>SetChar</B>(<B>size_t</B><I> n</I>, <B>char</B><I>ch</I>)<P>
Sets the character at position <I>n</I>.<P>
<HR>
<A NAME="wxstringshrink"></A>
<H3>wxString::Shrink</H3>
<P>
<B>void</B> <B>Shrink</B>()<P>
Minimizes the string's memory. This can be useful after a call to
<A HREF="wx224.htm#wxstringalloc">Alloc()</A> if too much memory were preallocated.<P>
<HR>
<A NAME="wxstringsprintf"></A>
<H3>wxString::sprintf</H3>
<P>
<B>void</B> <B>sprintf</B>(<B>const char* </B><I> fmt</I>)<P>
The same as Printf.<P>
<HR>
<A NAME="wxstringstrip"></A>
<H3>wxString::Strip</H3>
<P>
<PRE>
enum stripType {leading = 0x1, trailing = 0x2, both = 0x3};
</PRE>
<B>wxString</B> <B>Strip</B>(<B>stripType</B><I> s = trailing</I>) <B>const</B><P>
Strip characters at the front and/or end. The same as Trim except that it
doesn't change this string.<P>
<HR>
<A NAME="wxstringsubstring"></A>
<H3>wxString::SubString</H3>
<P>
<B>wxString</B> <B>SubString</B>(<B>size_t</B><I> to</I>, <B>size_t</B><I> from</I>) <B>const</B><P>
Same as <A HREF="wx224.htm#wxstringmid">Mid</A>.<P>
<HR>
<A NAME="wxstringtrim"></A>
<H3>wxString::Trim</H3>
<P>
<B>wxString&</B> <B>Trim</B>(<B>bool</B><I> fromRight = TRUE</I>)<P>
Removes spaces from the left or from the right (default).<P>
<HR>
<A NAME="wxstringtruncate"></A>
<H3>wxString::Truncate</H3>
<P>
<B>wxString&</B> <B>Truncate</B>(<B>size_t</B><I> len</I>)<P>
Truncate the string to the given length.<P>
<HR>
<A NAME="wxstringungetwritebuf"></A>
<H3>wxString::UngetWriteBuf</H3>
<P>
<B>void</B> <B>UngetWriteBuf</B>()<P>
Puts the string back into a reasonable state, after
<A HREF="wx224.htm#wxstringgetwritebuf">wxString::GetWriteBuf</A> was called.<P>
<HR>
<A NAME="wxstringupper"></A>
<H3>wxString::Upper</H3>
<P>
<B>wxString</B> <B>Upper</B>() <B>const</B><P>
Returns this string converted to upper case.<P>
<HR>
<A NAME="wxstringuppercase"></A>
<H3>wxString::UpperCase</H3>
<P>
<B>void</B> <B>UpperCase</B>()<P>
The same as MakeUpper.<P>
<HR>
<A NAME="wxstringoperatornot"></A>
<H3>wxString::operator!</H3>
<P>
<B>bool</B> <B>operator!</B>() <B>const</B><P>
Empty string is FALSE, so !string will only return TRUE if the string is empty.
This allows the tests for NULLness of a <I>const char *</I> pointer and emptyness
of the string to look the same in the code and makes it easier to port old code
to wxString.<P>
See also <A HREF="wx224.htm#wxstringisempty">IsEmpty()</A>.<P>
<HR>
<A NAME="wxstringoperatorassign"></A>
<H3>wxString::operator =</H3>
<P>
<B>wxString&</B> <B>operator =</B>(<B>const wxString&</B><I> str</I>)<P>
<B>wxString&</B> <B>operator =</B>(<B>const char*</B><I> psz</I>)<P>
<B>wxString&</B> <B>operator =</B>(<B>char</B><I> c</I>)<P>
<B>wxString&</B> <B>operator =</B>(<B>const unsigned char*</B><I> psz</I>)<P>
<B>wxString&</B> <B>operator =</B>(<B>const wchar_t*</B><I> pwz</I>)<P>
Assignment: the effect of each operation is the same as for the corresponding
constructor (see <A HREF="wx224.htm#wxstringconstruct">wxString constructors</A>).<P>
<HR>
<A NAME="wxstringoperatorplus"></A>
<H3>operator wxString::+</H3>
<P>
Concatenation: all these operators return a new strign equal to the sum of the
operands.<P>
<B>wxString</B> <B>operator +</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>wxString</B> <B>operator +</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> y</I>)<P>
<B>wxString</B> <B>operator +</B>(<B>const wxString&</B><I> x</I>, <B>char</B><I> y</I>)<P>
<B>wxString</B> <B>operator +</B>(<B>const char*</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<HR>
<A NAME="wxstringplusequal"></A>
<H3>wxString::operator +=</H3>
<P>
<B>void</B> <B>operator +=</B>(<B>const wxString&</B><I> str</I>)<P>
<B>void</B> <B>operator +=</B>(<B>const char*</B><I> psz</I>)<P>
<B>void</B> <B>operator +=</B>(<B>char</B><I> c</I>)<P>
Concatenation in place: the argument is appended to the string.<P>
<HR>
<A NAME="wxstringoperatorbracket"></A>
<H3>wxString::operator []</H3>
<P>
<B>char&</B> <B>operator []</B>(<B>size_t</B><I> i</I>)<P>
<B>char</B> <B>operator []</B>(<B>size_t</B><I> i</I>)<P>
<B>char</B> <B>operator []</B>(<B>int</B><I> i</I>)<P>
Element extraction.<P>
<HR>
<A NAME="wxstringoperatorparenth"></A>
<H3>wxString::operator ()</H3>
<P>
<B>wxString</B> <B>operator ()</B>(<B>size_t</B><I> start</I>, <B>size_t</B><I> len</I>)<P>
Same as Mid (substring extraction).<P>
<HR>
<A NAME="wxstringoperatorout"></A>
<H3>wxString::operator <<</H3>
<P>
<B>wxString&</B> <B>operator <<</B>(<B>const wxString&</B><I> str</I>)<P>
<B>wxString&</B> <B>operator <<</B>(<B>const char*</B><I> psz</I>)<P>
<B>wxString&</B> <B>operator <<</B>(<B>char </B><I>ch</I>)<P>
Same as +=.<P>
<B>wxString&</B> <B>operator <<</B>(<B>int</B><I> i</I>)<P>
<B>wxString&</B> <B>operator <<</B>(<B>float</B><I> f</I>)<P>
<B>wxString&</B> <B>operator <<</B>(<B>double</B><I> d</I>)<P>
These functions work as C++ stream insertion operators: they insert the given
value into the string. Precision or format cannot be set using them, you can use
<A HREF="wx224.htm#wxstringprintf">Printf</A> for this.<P>
<HR>
<A NAME="wxstringoperatorin"></A>
<H3>wxString::operator >></H3>
<P>
<B>friend istream&</B> <B>operator >></B>(<B>istream&</B><I> is</I>, <B>wxString&</B><I> str</I>)<P>
Extraction from a stream.<P>
<HR>
<A NAME="wxstringoperatorconstcharpt"></A>
<H3>wxString::operator const char*</H3>
<P>
<B></B> <B>operator const char*</B>() <B>const</B><P>
Implicit conversion to a C string.<P>
<HR>
<A NAME="wxstringcomparison"></A>
<H3>Comparison operators</H3>
<P>
<B>bool</B> <B>operator ==</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator ==</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B>bool</B> <B>operator !=</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator !=</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B>bool</B> <B>operator ></B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator ></B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B>bool</B> <B>operator >=</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator >=</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B>bool</B> <B>operator <</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator <</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B>bool</B> <B>operator <=</B>(<B>const wxString&</B><I> x</I>, <B>const wxString&</B><I> y</I>)<P>
<B>bool</B> <B>operator <=</B>(<B>const wxString&</B><I> x</I>, <B>const char*</B><I> t</I>)<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
These comparisons are case-sensitive.<P>
</BODY></HTML>
|