]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxString}}\label{wxstring} |
2 | ||
40b480c3 JS |
3 | wxString is a class representing a character string. Please see the |
4 | \helpref{wxString overview}{wxstringoverview} for more information about it. As explained | |
5 | there, wxString implements about 90\% of methods of the std::string class (iterators | |
6 | are not supported, nor all methods which use them). | |
7 | These standard functions are not documented in this manual so please see the STL documentation. | |
99f09bc1 VZ |
8 | The behaviour of all these functions is identical to the behaviour described |
9 | there. | |
10 | ||
b3324be2 JS |
11 | \wxheading{Derived from} |
12 | ||
13 | None | |
a660d684 | 14 | |
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/string.h> | |
18 | ||
20e85460 JS |
19 | \wxheading{Predefined objects} |
20 | ||
21 | Objects: | |
22 | ||
23 | {\bf wxEmptyString} | |
24 | ||
b3324be2 JS |
25 | \wxheading{See also} |
26 | ||
27 | \overview{Overview}{wxstringoverview} | |
a660d684 | 28 | |
99f09bc1 VZ |
29 | \latexignore{\rtfignore{\wxheading{Function groups}}} |
30 | ||
31 | \membersection{Constructors and assignment operators} | |
32 | ||
33 | A strign may be constructed either from a C string, (some number of copies of) | |
34 | a single character or a wide (UNICODE) string. For all constructors (except the | |
35 | default which creates an empty string) there is also a corresponding assignment | |
36 | operator. | |
37 | ||
38 | \helpref{wxString}{wxstringconstruct}\\ | |
39 | \helpref{operator $=$}{wxstringoperatorassign}\\ | |
40 | \helpref{\destruct{wxString}}{wxstringdestruct} | |
41 | ||
42 | \membersection{String length} | |
43 | ||
44 | These functions return the string length and check whether the string is empty | |
45 | or empty it. | |
46 | ||
47 | \helpref{Len}{wxstringlen}\\ | |
48 | \helpref{IsEmpty}{wxstringisempty}\\ | |
49 | \helpref{operator!}{wxstringoperatornot}\\ | |
50 | \helpref{Empty}{wxstringempty}\\ | |
51 | \helpref{Clear}{wxstringclear} | |
52 | ||
53 | \membersection{Character access} | |
54 | ||
55 | Many functions in this section take a character index in the string. As with C | |
56 | strings and/or arrays, the indices start from $0$, so the first character of a | |
57 | string is string[$0$]. Attempt to access a character beyond the end of the | |
58 | string (which may be even $0$ if the string is empty) will provocate an assert | |
59 | failure in \helpref{debug build}{debuggingoverview}, but no checks are done in | |
60 | release builds. | |
61 | ||
62 | This section also contains both implicit and explicit conversions to C style | |
63 | strings. Although implicit conversion is quite convenient, it is advised to use | |
64 | explicit \helpref{c\_str()}{wxstringcstr} method for the sake of clarity. Also | |
fd34e3a5 | 65 | see \helpref{overview}{wxstringadvices} for the cases where it is necessary to |
99f09bc1 VZ |
66 | use it. |
67 | ||
68 | \helpref{GetChar}{wxstringgetchar}\\ | |
69 | \helpref{GetWritableChar}{wxstringgetwritablechar}\\ | |
70 | \helpref{SetChar}{wxstringsetchar}\\ | |
71 | \helpref{Last}{wxstringlast}\\ | |
72 | \helpref{operator []}{wxstringoperatorbracket}\\ | |
73 | \helpref{c\_str}{wxstringcstr}\\ | |
74 | \helpref{operator const char*}{wxstringoperatorconstcharpt} | |
75 | ||
76 | \membersection{Concatenation} | |
77 | ||
78 | Anything may be concatenated (appended to) with a string. However, you can't | |
79 | append something to a C string (including literal constants), so to do this it | |
80 | should be converted to a wxString first. | |
81 | ||
82 | \helpref{operator \cinsert}{wxstringoperatorout}\\ | |
83 | \helpref{operator $+=$}{wxstringplusequal}\\ | |
84 | \helpref{operator $+$}{wxstringoperatorplus}\\ | |
85 | \helpref{Append}{wxstringappend}\\ | |
86 | \helpref{Prepend}{wxstringprepend} | |
87 | ||
88 | \membersection{Comparison} | |
89 | ||
90 | The default comparison function \helpref{Cmp}{wxstringcmp} is case-sensitive and | |
91 | so is the default version of \helpref{IsSameAs}{wxstringissameas}. For case | |
92 | insensitive comparisons you should use \helpref{CmpNoCase}{wxstringcmpnocase} or | |
93 | give a second parameter to IsSameAs. This last function is may be more | |
94 | convenient if only equality of the strings matters because it returns a boolean | |
95 | true value if the strings are the same and not 0 (which is usually FALSE in C) | |
96 | as Cmp does. | |
97 | ||
98 | \helpref{Matches}{wxstringmatches} is a poor man's regular expression matcher: | |
99 | it only understands '*' and '?' metacharacters in the sense of DOS command line | |
100 | interpreter. | |
101 | ||
102 | \helpref{Cmp}{wxstringcmp}\\ | |
103 | \helpref{CmpNoCase}{wxstringcmpnocase}\\ | |
104 | \helpref{IsSameAs}{wxstringissameas}\\ | |
105 | \helpref{Matches}{wxstringmatches} | |
106 | ||
107 | \membersection{Substring extraction} | |
108 | ||
109 | These functions allow to extract substring from this string. All of them don't | |
110 | modify the original string and return a new string containing the extracted | |
111 | substring. | |
112 | ||
113 | \helpref{Mid}{wxstringmid}\\ | |
114 | \helpref{operator()}{wxstringoperatorparenth}\\ | |
115 | \helpref{Left}{wxstringleft}\\ | |
116 | \helpref{Right}{wxstringright}\\ | |
117 | \helpref{BeforeFirst}{wxstringbeforefirst}\\ | |
118 | \helpref{BeforeLast}{wxstringbeforelast}\\ | |
119 | \helpref{AfterFirst}{wxstringafterfirst}\\ | |
120 | \helpref{AfterLast}{wxstringafterlast} | |
121 | ||
122 | \membersection{Case conversion} | |
123 | ||
124 | The MakeXXX() variants modify the string in place, while the other functions | |
125 | return a new string which containts the original text converted to the upper or | |
126 | lower case and leave the original string unchanged. | |
127 | ||
128 | \helpref{MakeUpper}{wxstringmakeupper}\\ | |
129 | \helpref{Upper}{wxstringupper}\\ | |
130 | \helpref{MakeLower}{wxstringmakelower}\\ | |
131 | \helpref{Lower}{wxstringlower} | |
132 | ||
133 | \membersection{Searching and replacing} | |
134 | ||
40b480c3 | 135 | These functions replace the standard {\it strchr()} and {\it strstr()} |
99f09bc1 VZ |
136 | functions. |
137 | ||
138 | \helpref{Find}{wxstringfind}\\ | |
139 | \helpref{Replace}{wxstringreplace} | |
140 | ||
cd0b1709 VZ |
141 | \membersection{Conversion to numbers} |
142 | ||
143 | The string provides functions for conversion to signed and unsigned integer and | |
144 | floating point numbers. All three functions take a pointer to the variable to | |
145 | put the numeric value in and return TRUE if the {\bf entire} string could be | |
146 | converted to a number. | |
147 | ||
148 | \helpref{ToLong}{wxstringtolong}\\ | |
149 | \helpref{ToULong}{wxstringtoulong}\\ | |
150 | \helpref{ToDouble}{wxstringtodouble} | |
151 | ||
99f09bc1 VZ |
152 | \membersection{Writing values into the string} |
153 | ||
154 | Both formatted versions (\helpref{Printf}{wxstringprintf}) and stream-like | |
341e7d28 VZ |
155 | insertion operators exist (for basic types only). Additionally, the |
156 | \helpref{Format}{wxstringformat} function allows to use simply append | |
157 | formatted value to a string: | |
99f09bc1 | 158 | |
341e7d28 VZ |
159 | \begin{verbatim} |
160 | // the following 2 snippets are equivalent | |
161 | ||
162 | wxString s = "..."; | |
163 | s += wxString::Format("%d", n); | |
164 | ||
165 | wxString s; | |
166 | s.Printf("...%d", n); | |
167 | \end{verbatim} | |
168 | ||
169 | \helpref{Format}{wxstringformat}\\ | |
170 | \helpref{FormatV}{wxstringformatv}\\ | |
99f09bc1 VZ |
171 | \helpref{Printf}{wxstringprintf}\\ |
172 | \helpref{PrintfV}{wxstringprintfv}\\ | |
40b480c3 | 173 | \helpref{operator \cinsert}{wxstringoperatorout} |
99f09bc1 VZ |
174 | |
175 | \membersection{Memory management} | |
176 | ||
177 | These are "advanced" functions and they will be needed quite rarily. | |
178 | \helpref{Alloc}{wxstringalloc} and \helpref{Shrink}{wxstringshrink} are only | |
179 | interesting for optimization purposes. | |
180 | \helpref{GetWriteBuf}{wxstringgetwritebuf} may be very useful when working with | |
181 | some external API which requires the caller to provide a writable buffer, but | |
182 | extreme care should be taken when using it: before performing any other | |
183 | operation on the string \helpref{UngetWriteBuf}{wxstringungetwritebuf} {\bf | |
184 | must} be called! | |
185 | ||
186 | \helpref{Alloc}{wxstringalloc}\\ | |
187 | \helpref{Shrink}{wxstringshrink}\\ | |
188 | \helpref{GetWriteBuf}{wxstringgetwritebuf}\\ | |
189 | \helpref{UngetWriteBuf}{wxstringungetwritebuf} | |
190 | ||
191 | \membersection{Miscellaneous} | |
192 | ||
193 | Other string functions. | |
194 | ||
195 | \helpref{Trim}{wxstringtrim}\\ | |
196 | \helpref{Pad}{wxstringpad}\\ | |
197 | \helpref{Truncate}{wxstringtruncate} | |
198 | ||
199 | \membersection{wxWindows 1.xx compatiblity functions} | |
200 | ||
201 | These functiosn are deprecated, please consider using new wxWindows 2.0 | |
202 | functions instead of them (or, even better, std::string compatible variants). | |
203 | ||
204 | \helpref{SubString}{wxstringsubstring}\\ | |
205 | \helpref{sprintf}{wxstringsprintf}\\ | |
206 | \helpref{CompareTo}{wxstringcompareto}\\ | |
207 | \helpref{Length}{wxstringlength}\\ | |
208 | \helpref{Freq}{wxstringfreq}\\ | |
209 | \helpref{LowerCase}{wxstringlowercase}\\ | |
210 | \helpref{UpperCase}{wxstringuppercase}\\ | |
211 | \helpref{Strip}{wxstringstrip}\\ | |
212 | \helpref{Index}{wxstringindex}\\ | |
213 | \helpref{Remove}{wxstringremove}\\ | |
214 | \helpref{First}{wxstringfirst}\\ | |
215 | \helpref{Last}{wxstringlast}\\ | |
216 | \helpref{Contains}{wxstringcontains}\\ | |
217 | \helpref{IsNull}{wxstringisnull}\\ | |
218 | \helpref{IsAscii}{wxstringisascii}\\ | |
219 | \helpref{IsNumber}{wxstringisnumber}\\ | |
220 | \helpref{IsWord}{wxstringisword} | |
221 | ||
ed93168b | 222 | \membersection{std::string compatibility functions}\label{wxstringat} |
99f09bc1 VZ |
223 | |
224 | The supported functions are only listed here, please see any STL reference for | |
225 | their documentation. | |
226 | ||
227 | \begin{verbatim} | |
228 | // take nLen chars starting at nPos | |
229 | wxString(const wxString& str, size_t nPos, size_t nLen); | |
230 | // take all characters from pStart to pEnd (poor man's iterators) | |
231 | wxString(const void *pStart, const void *pEnd); | |
232 | ||
233 | // lib.string.capacity | |
234 | // return the length of the string | |
235 | size_t size() const; | |
236 | // return the length of the string | |
237 | size_t length() const; | |
238 | // return the maximum size of the string | |
239 | size_t max_size() const; | |
240 | // resize the string, filling the space with c if c != 0 | |
241 | void resize(size_t nSize, char ch = '\0'); | |
242 | // delete the contents of the string | |
243 | void clear(); | |
244 | // returns true if the string is empty | |
245 | bool empty() const; | |
246 | ||
247 | // lib.string.access | |
248 | // return the character at position n | |
249 | char at(size_t n) const; | |
250 | // returns the writable character at position n | |
251 | char& at(size_t n); | |
252 | ||
253 | // lib.string.modifiers | |
254 | // append a string | |
255 | wxString& append(const wxString& str); | |
256 | // append elements str[pos], ..., str[pos+n] | |
257 | wxString& append(const wxString& str, size_t pos, size_t n); | |
258 | // append first n (or all if n == npos) characters of sz | |
259 | wxString& append(const char *sz, size_t n = npos); | |
260 | ||
261 | // append n copies of ch | |
262 | wxString& append(size_t n, char ch); | |
263 | ||
264 | // same as `this_string = str' | |
265 | wxString& assign(const wxString& str); | |
266 | // same as ` = str[pos..pos + n] | |
267 | wxString& assign(const wxString& str, size_t pos, size_t n); | |
268 | // same as `= first n (or all if n == npos) characters of sz' | |
269 | wxString& assign(const char *sz, size_t n = npos); | |
270 | // same as `= n copies of ch' | |
271 | wxString& assign(size_t n, char ch); | |
272 | ||
273 | // insert another string | |
274 | wxString& insert(size_t nPos, const wxString& str); | |
275 | // insert n chars of str starting at nStart (in str) | |
276 | wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n); | |
277 | ||
278 | // insert first n (or all if n == npos) characters of sz | |
279 | wxString& insert(size_t nPos, const char *sz, size_t n = npos); | |
280 | // insert n copies of ch | |
281 | wxString& insert(size_t nPos, size_t n, char ch); | |
282 | ||
283 | // delete characters from nStart to nStart + nLen | |
284 | wxString& erase(size_t nStart = 0, size_t nLen = npos); | |
285 | ||
286 | // replaces the substring of length nLen starting at nStart | |
287 | wxString& replace(size_t nStart, size_t nLen, const char* sz); | |
288 | // replaces the substring with nCount copies of ch | |
289 | wxString& replace(size_t nStart, size_t nLen, size_t nCount, char ch); | |
290 | // replaces a substring with another substring | |
291 | wxString& replace(size_t nStart, size_t nLen, | |
292 | const wxString& str, size_t nStart2, size_t nLen2); | |
293 | // replaces the substring with first nCount chars of sz | |
294 | wxString& replace(size_t nStart, size_t nLen, | |
295 | const char* sz, size_t nCount); | |
296 | ||
297 | // swap two strings | |
298 | void swap(wxString& str); | |
299 | ||
300 | // All find() functions take the nStart argument which specifies the | |
301 | // position to start the search on, the default value is 0. All functions | |
302 | // return npos if there were no match. | |
303 | ||
304 | // find a substring | |
305 | size_t find(const wxString& str, size_t nStart = 0) const; | |
306 | ||
307 | // find first n characters of sz | |
308 | size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const; | |
309 | ||
310 | // find the first occurence of character ch after nStart | |
311 | size_t find(char ch, size_t nStart = 0) const; | |
312 | ||
313 | // rfind() family is exactly like find() but works right to left | |
314 | ||
315 | // as find, but from the end | |
316 | size_t rfind(const wxString& str, size_t nStart = npos) const; | |
317 | ||
318 | // as find, but from the end | |
319 | size_t rfind(const char* sz, size_t nStart = npos, | |
320 | size_t n = npos) const; | |
321 | // as find, but from the end | |
322 | size_t rfind(char ch, size_t nStart = npos) const; | |
323 | ||
324 | // find first/last occurence of any character in the set | |
325 | ||
326 | // | |
327 | size_t find_first_of(const wxString& str, size_t nStart = 0) const; | |
328 | // | |
329 | size_t find_first_of(const char* sz, size_t nStart = 0) const; | |
330 | // same as find(char, size_t) | |
331 | size_t find_first_of(char c, size_t nStart = 0) const; | |
332 | // | |
333 | size_t find_last_of (const wxString& str, size_t nStart = npos) const; | |
334 | // | |
335 | size_t find_last_of (const char* s, size_t nStart = npos) const; | |
336 | // same as rfind(char, size_t) | |
337 | size_t find_last_of (char c, size_t nStart = npos) const; | |
338 | ||
339 | // find first/last occurence of any character not in the set | |
340 | ||
341 | // | |
342 | size_t find_first_not_of(const wxString& str, size_t nStart = 0) const; | |
343 | // | |
344 | size_t find_first_not_of(const char* s, size_t nStart = 0) const; | |
345 | // | |
346 | size_t find_first_not_of(char ch, size_t nStart = 0) const; | |
347 | // | |
348 | size_t find_last_not_of(const wxString& str, size_t nStart=npos) const; | |
349 | // | |
350 | size_t find_last_not_of(const char* s, size_t nStart = npos) const; | |
351 | // | |
352 | size_t find_last_not_of(char ch, size_t nStart = npos) const; | |
353 | ||
354 | // All compare functions return a negative, zero or positive value | |
355 | // if the [sub]string is less, equal or greater than the compare() argument. | |
356 | ||
357 | // just like strcmp() | |
358 | int compare(const wxString& str) const; | |
359 | // comparison with a substring | |
360 | int compare(size_t nStart, size_t nLen, const wxString& str) const; | |
361 | // comparison of 2 substrings | |
362 | int compare(size_t nStart, size_t nLen, | |
363 | const wxString& str, size_t nStart2, size_t nLen2) const; | |
364 | // just like strcmp() | |
365 | int compare(const char* sz) const; | |
366 | // substring comparison with first nCount characters of sz | |
367 | int compare(size_t nStart, size_t nLen, | |
368 | const char* sz, size_t nCount = npos) const; | |
369 | ||
370 | // substring extraction | |
371 | wxString substr(size_t nStart = 0, size_t nLen = npos) const; | |
372 | \end{verbatim} | |
373 | ||
374 | %%%%% MEMBERS HERE %%%%% | |
375 | \helponly{\insertatlevel{2}{ | |
376 | ||
377 | \wxheading{Members} | |
378 | ||
379 | }} | |
a660d684 KB |
380 | |
381 | \membersection{wxString::wxString}\label{wxstringconstruct} | |
382 | ||
b3324be2 | 383 | \func{}{wxString}{\void} |
a660d684 | 384 | |
b3324be2 | 385 | Default constructor. |
a660d684 | 386 | |
b3324be2 | 387 | \func{}{wxString}{\param{const wxString\&}{ x}} |
a660d684 | 388 | |
b3324be2 | 389 | Copy constructor. |
a660d684 | 390 | |
b3324be2 | 391 | \func{}{wxString}{\param{char}{ ch}, \param{size\_t}{ n = 1}} |
a660d684 | 392 | |
b3324be2 | 393 | Constructs a string of {\it n} copies of character {\it ch}. |
a660d684 | 394 | |
99f09bc1 | 395 | \func{}{wxString}{\param{const char*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}} |
a660d684 | 396 | |
b3324be2 | 397 | Takes first {\it nLength} characters from the C string {\it psz}. |
99f09bc1 | 398 | The default value of wxSTRING\_MAXLEN means take all the string. |
a660d684 | 399 | |
99f09bc1 | 400 | \func{}{wxString}{\param{const unsigned char*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}} |
a660d684 | 401 | |
b3324be2 | 402 | For compilers using unsigned char: takes first {\it nLength} characters from the C string {\it psz}. |
99f09bc1 | 403 | The default value of wxSTRING\_MAXLEN means take all the string. |
a660d684 | 404 | |
b3324be2 | 405 | \func{}{wxString}{\param{const wchar\_t*}{ psz}} |
a660d684 | 406 | |
b3324be2 | 407 | Constructs a string from the wide (UNICODE) string. |
a660d684 | 408 | |
b3324be2 | 409 | \membersection{wxString::\destruct{wxString}}\label{wxstringdestruct} |
a660d684 | 410 | |
b3324be2 | 411 | \func{}{\destruct{wxString}}{\void} |
a660d684 | 412 | |
b3324be2 | 413 | String destructor. Note that this is not virtual, so wxString must not be inherited from. |
a660d684 | 414 | |
99f09bc1 VZ |
415 | \membersection{wxString::Alloc}\label{wxstringalloc} |
416 | ||
417 | \func{void}{Alloc}{\param{size\_t}{ nLen}} | |
418 | ||
419 | Preallocate enough space for wxString to store {\it nLen} characters. This function | |
420 | may be used to increase speed when the string is constructed by repeated | |
421 | concatenation as in | |
422 | ||
423 | \begin{verbatim} | |
a660d684 | 424 | |
99f09bc1 VZ |
425 | // delete all vowels from the string |
426 | wxString DeleteAllVowels(const wxString& original) | |
427 | { | |
428 | wxString result; | |
a660d684 | 429 | |
99f09bc1 | 430 | size_t len = original.length(); |
a660d684 | 431 | |
99f09bc1 VZ |
432 | result.Alloc(len); |
433 | ||
434 | for ( size_t n = 0; n < len; n++ ) | |
435 | { | |
436 | if ( strchr("aeuio", tolower(original[n])) == NULL ) | |
437 | result += original[n]; | |
438 | } | |
439 | ||
440 | return result; | |
441 | } | |
442 | ||
443 | \end{verbatim} | |
444 | ||
445 | because it will avoid the need of reallocating string memory many times (in case | |
446 | of long strings). Note that it does not set the maximal length of a string - it | |
447 | will still expand if more than {\it nLen} characters are stored in it. Also, it | |
448 | does not truncate the existing string (use | |
449 | \helpref{Truncate()}{wxstringtruncate} for this) even if its current length is | |
450 | greater than {\it nLen} | |
451 | ||
452 | \membersection{wxString::Append}\label{wxstringappend} | |
b3324be2 JS |
453 | |
454 | \func{wxString\&}{Append}{\param{const char*}{ psz}} | |
a660d684 | 455 | |
b3324be2 | 456 | Concatenates {\it psz} to this string, returning a reference to it. |
a660d684 | 457 | |
b3324be2 | 458 | \func{wxString\&}{Append}{\param{char}{ ch}, \param{int}{ count = 1}} |
a660d684 | 459 | |
b3324be2 JS |
460 | Concatenates character {\it ch} to this string, {\it count} times, returning a reference |
461 | to it. | |
462 | ||
99f09bc1 | 463 | \membersection{wxString::AfterFirst}\label{wxstringafterfirst} |
b3324be2 | 464 | |
99f09bc1 | 465 | \constfunc{wxString}{AfterFirst}{\param{char}{ ch}} |
b3324be2 JS |
466 | |
467 | Gets all the characters after the first occurence of {\it ch}. | |
468 | Returns the empty string if {\it ch} is not found. | |
a660d684 | 469 | |
99f09bc1 | 470 | \membersection{wxString::AfterLast}\label{wxstringafterlast} |
a660d684 | 471 | |
99f09bc1 VZ |
472 | \constfunc{wxString}{AfterLast}{\param{char}{ ch}} |
473 | ||
474 | Gets all the characters after the last occurence of {\it ch}. | |
475 | Returns the whole string if {\it ch} is not found. | |
476 | ||
477 | \membersection{wxString::BeforeFirst}\label{wxstringbeforefirst} | |
478 | ||
479 | \constfunc{wxString}{BeforeFirst}{\param{char}{ ch}} | |
480 | ||
481 | Gets all characters before the first occurence of {\it ch}. | |
482 | Returns the whole string if {\it ch} is not found. | |
483 | ||
484 | \membersection{wxString::BeforeLast}\label{wxstringbeforelast} | |
485 | ||
486 | \constfunc{wxString}{BeforeLast}{\param{char}{ ch}} | |
b3324be2 JS |
487 | |
488 | Gets all characters before the last occurence of {\it ch}. | |
99f09bc1 | 489 | Returns the empty string if {\it ch} is not found. |
a660d684 | 490 | |
ed93168b VZ |
491 | \membersection{wxString::c\_str}\label{wxstringcstr} |
492 | ||
493 | \constfunc{const char *}{c\_str}{\void} | |
494 | ||
495 | Returns a pointer to the string data. | |
496 | ||
497 | \membersection{wxString::Clear}\label{wxstringclear} | |
498 | ||
499 | \func{void}{Clear}{\void} | |
500 | ||
501 | Empties the string and frees memory occupied by it. | |
502 | ||
503 | See also: \helpref{Empty}{wxstringempty} | |
504 | ||
f7bd2698 JS |
505 | \membersection{wxString::Cmp}\label{wxstringcmp} |
506 | ||
507 | \constfunc{int}{Cmp}{\param{const char*}{ psz}} | |
508 | ||
509 | Case-sensitive comparison. | |
510 | ||
99f09bc1 VZ |
511 | Returns a positive value if the string is greater than the argument, zero if |
512 | it si equal to it or negative value if it is less than argument (same semantics | |
513 | as the standard {\it strcmp()} function). | |
f7bd2698 | 514 | |
99f09bc1 | 515 | See also \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissameas}. |
f7bd2698 JS |
516 | |
517 | \membersection{wxString::CmpNoCase}\label{wxstringcmpnocase} | |
518 | ||
519 | \constfunc{int}{CmpNoCase}{\param{const char*}{ psz}} | |
520 | ||
521 | Case-insensitive comparison. | |
522 | ||
99f09bc1 VZ |
523 | Returns a positive value if the string is greater than the argument, zero if |
524 | it si equal to it or negative value if it is less than argument (same semantics | |
525 | as the standard {\it strcmp()} function). | |
f7bd2698 | 526 | |
99f09bc1 | 527 | See also \helpref{Cmp}{wxstringcmp}, \helpref{IsSameAs}{wxstringissameas}. |
f7bd2698 | 528 | |
99f09bc1 | 529 | \membersection{wxString::CompareTo}\label{wxstringcompareto} |
a660d684 KB |
530 | |
531 | \begin{verbatim} | |
532 | #define NO_POS ((int)(-1)) // undefined position | |
b3324be2 | 533 | enum caseCompare {exact, ignoreCase}; |
a660d684 | 534 | \end{verbatim} |
ed93168b | 535 | |
b3324be2 | 536 | \constfunc{int}{CompareTo}{\param{const char*}{ psz}, \param{caseCompare}{ cmp = exact}} |
a660d684 | 537 | |
b3324be2 | 538 | Case-sensitive comparison. Returns 0 if equal, 1 if greater or -1 if less. |
a660d684 | 539 | |
99f09bc1 | 540 | \membersection{wxString::Contains}\label{wxstringcontains} |
a660d684 | 541 | |
99f09bc1 | 542 | \constfunc{bool}{Contains}{\param{const wxString\&}{ str}} |
a660d684 | 543 | |
b3324be2 | 544 | Returns 1 if target appears anyhere in wxString; else 0. |
a660d684 | 545 | |
f7bd2698 | 546 | \membersection{wxString::Empty}\label{wxstringempty} |
a660d684 | 547 | |
f7bd2698 JS |
548 | \func{void}{Empty}{\void} |
549 | ||
ed93168b VZ |
550 | Makes the string empty, but doesn't free memory occupied by the string. |
551 | ||
552 | See also: \helpref{Clear()}{wxstringclear}. | |
f7bd2698 JS |
553 | |
554 | \membersection{wxString::Find}\label{wxstringfind} | |
555 | ||
556 | \constfunc{int}{Find}{\param{char}{ ch}, \param{bool}{ fromEnd = FALSE}} | |
557 | ||
558 | Searches for the given character. Returns the starting index, or -1 if not found. | |
559 | ||
560 | \constfunc{int}{Find}{\param{const char*}{ sz}} | |
561 | ||
562 | Searches for the given string. Returns the starting index, or -1 if not found. | |
a660d684 | 563 | |
b3324be2 | 564 | \membersection{wxString::First}\label{wxstringfirst} |
a660d684 | 565 | |
b3324be2 | 566 | \func{size\_t}{First}{\param{char}{ c}} |
a660d684 | 567 | |
b3324be2 | 568 | \constfunc{size\_t}{First}{\param{const char*}{ psz}} |
a660d684 | 569 | |
b3324be2 | 570 | \constfunc{size\_t}{First}{\param{const wxString\&}{ str}} |
a660d684 | 571 | |
b3324be2 | 572 | \constfunc{size\_t}{First}{\param{const char}{ ch}} |
a660d684 | 573 | |
f7bd2698 | 574 | Returns the first occurrence of the item. |
a660d684 | 575 | |
341e7d28 VZ |
576 | \membersection{wxString::Format}\label{wxstringformat} |
577 | ||
578 | \func{static wxString}{Format}{\param{const wxChar }{*format}, \param{}{...}} | |
579 | ||
580 | This static function returns the string containing the result of calling | |
581 | \helpref{Printf}{wxstringprintf} with the passed parameters on it. | |
582 | ||
583 | \wxheading{See also} | |
584 | ||
585 | \helpref{FormatV}{wxstringformatv}, \helpref{Printf}{wxstringprintf} | |
586 | ||
587 | \membersection{wxString::FormatV}\label{wxstringformatv} | |
588 | ||
589 | \func{static wxString}{Format}{\param{const wxChar }{*format}, \param{va\_list }{argptr}} | |
590 | ||
591 | This static function returns the string containing the result of calling | |
592 | \helpref{PrintfV}{wxstringprintfv} with the passed parameters on it. | |
593 | ||
594 | \wxheading{See also} | |
595 | ||
596 | \helpref{Format}{wxstringformat}, \helpref{PrintfV}{wxstringprintfv} | |
597 | ||
99f09bc1 VZ |
598 | \membersection{wxString::Freq}\label{wxstringfreq} |
599 | ||
600 | \constfunc{int}{Frec}{\param{char }{ch}} | |
601 | ||
602 | Returns the number of occurences of {it ch} in the string. | |
603 | ||
f7bd2698 | 604 | \membersection{wxString::GetChar}\label{wxstringgetchar} |
a660d684 | 605 | |
f7bd2698 | 606 | \constfunc{char}{GetChar}{\param{size\_t}{ n}} |
a660d684 | 607 | |
f7bd2698 | 608 | Returns the character at position {\it n} (read-only). |
a660d684 | 609 | |
99f09bc1 | 610 | \membersection{wxString::GetData}\label{wxstringgetdata} |
a660d684 | 611 | |
f7bd2698 | 612 | \constfunc{const char*}{GetData}{\void} |
a660d684 | 613 | |
f7bd2698 | 614 | wxWindows compatibility conversion. Returns a constant pointer to the data in the string. |
a660d684 | 615 | |
f7bd2698 | 616 | \membersection{wxString::GetWritableChar}\label{wxstringgetwritablechar} |
a660d684 | 617 | |
f7bd2698 | 618 | \func{char\&}{GetWritableChar}{\param{size\_t}{ n}} |
a660d684 | 619 | |
f7bd2698 | 620 | Returns a reference to the character at position {\it n}. |
a660d684 | 621 | |
f7bd2698 | 622 | \membersection{wxString::GetWriteBuf}\label{wxstringgetwritebuf} |
a660d684 | 623 | |
99f09bc1 | 624 | \func{char*}{GetWriteBuf}{\param{size\_t}{ len}} |
a660d684 | 625 | |
f7bd2698 | 626 | Returns a writable buffer of at least {\it len} bytes. |
a660d684 | 627 | |
f7bd2698 JS |
628 | Call \helpref{wxString::UngetWriteBuf}{wxstringungetwritebuf} as soon as possible |
629 | to put the string back into a reasonable state. | |
a660d684 | 630 | |
99f09bc1 | 631 | \membersection{wxString::Index}\label{wxstringindex} |
a660d684 | 632 | |
f7bd2698 | 633 | \constfunc{size\_t}{Index}{\param{char}{ ch}, \param{int}{ startpos = 0}} |
a660d684 | 634 | |
f7bd2698 | 635 | Same as \helpref{wxString::Find}{wxstringfind}. |
a660d684 | 636 | |
f7bd2698 | 637 | \constfunc{size\_t}{Index}{\param{const char*}{ sz}} |
a660d684 | 638 | |
f7bd2698 | 639 | Same as \helpref{wxString::Find}{wxstringfind}. |
a660d684 | 640 | |
f7bd2698 | 641 | \constfunc{size\_t}{Index}{\param{const char*}{ sz}, \param{bool}{ caseSensitive = TRUE}, \param{bool}{ fromEnd = FALSE}} |
a660d684 | 642 | |
f7bd2698 | 643 | Search the element in the array, starting from either side. |
a660d684 | 644 | |
f7bd2698 | 645 | If {\it fromEnd} is TRUE, reverse search direction. |
a660d684 | 646 | |
f7bd2698 | 647 | If {\bf caseSensitive}, comparison is case sensitive (the default). |
a660d684 | 648 | |
f7bd2698 | 649 | Returns the index of the first item matched, or NOT\_FOUND. |
a660d684 | 650 | |
8a2c6ef8 JS |
651 | % TODO |
652 | %\membersection{wxString::insert}\label{wxstringinsert} | |
653 | % Wrong! | |
99f09bc1 | 654 | %\func{void}{insert}{\param{const wxString\&}{ str}, \param{size\_t}{ index}} |
8a2c6ef8 JS |
655 | % |
656 | %Add new element at the given position. | |
657 | % | |
99f09bc1 | 658 | \membersection{wxString::IsAscii}\label{wxstringisascii} |
a660d684 | 659 | |
f7bd2698 | 660 | \constfunc{bool}{IsAscii}{\void} |
a660d684 | 661 | |
f7bd2698 | 662 | Returns TRUE if the string is ASCII. |
a660d684 | 663 | |
f7bd2698 | 664 | \membersection{wxString::IsEmpty}\label{wxstringisempty} |
a660d684 | 665 | |
f7bd2698 | 666 | \constfunc{bool}{IsEmpty}{\void} |
a660d684 | 667 | |
f7bd2698 | 668 | Returns TRUE if the string is NULL. |
a660d684 | 669 | |
99f09bc1 | 670 | \membersection{wxString::IsNull}\label{wxstringisnull} |
a660d684 | 671 | |
f7bd2698 | 672 | \constfunc{bool}{IsNull}{\void} |
a660d684 | 673 | |
f7bd2698 | 674 | Returns TRUE if the string is NULL (same as IsEmpty). |
a660d684 | 675 | |
99f09bc1 | 676 | \membersection{wxString::IsNumber}\label{wxstringisnumber} |
a660d684 | 677 | |
f7bd2698 JS |
678 | \constfunc{bool}{IsNumber}{\void} |
679 | ||
680 | Returns TRUE if the string is a number. | |
681 | ||
682 | \membersection{wxString::IsSameAs}\label{wxstringissameas} | |
683 | ||
684 | \constfunc{bool}{IsSameAs}{\param{const char*}{ psz}, \param{bool}{ caseSensitive = TRUE}} | |
685 | ||
686 | Test for string equality, case-sensitive (default) or not. | |
687 | ||
688 | caseSensitive is TRUE by default (case matters). | |
a660d684 | 689 | |
f7bd2698 JS |
690 | Returns TRUE if strings are equal, FALSE otherwise. |
691 | ||
f33fee2a VZ |
692 | See also \helpref{Cmp}{wxstringcmp}, \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissameas2} |
693 | ||
694 | \membersection{wxString::IsSameAs}\label{wxstringissameas2} | |
695 | ||
696 | \constfunc{bool}{IsSameAs}{\param{char}{ c}, \param{bool}{ caseSensitive = TRUE}} | |
697 | ||
698 | Test whether the string is equal to the single character {\it c}. The test is | |
699 | case-sensitive if {\it caseSensitive} is TRUE (default) or not if it is FALSE. | |
700 | ||
701 | Returns TRUE if the string is equal to the character, FALSE otherwise. | |
702 | ||
703 | See also \helpref{Cmp}{wxstringcmp}, \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissameas} | |
a660d684 | 704 | |
99f09bc1 | 705 | \membersection{wxString::IsWord}\label{wxstringisword} |
a660d684 | 706 | |
f7bd2698 | 707 | \constfunc{bool}{IsWord}{\void} |
a660d684 | 708 | |
f7bd2698 | 709 | Returns TRUE if the string is a word. TODO: what's the definition of a word? |
a660d684 | 710 | |
99f09bc1 | 711 | \membersection{wxString::Last}\label{wxstringlast} |
a660d684 | 712 | |
f7bd2698 | 713 | \constfunc{char}{Last}{\void} |
a660d684 | 714 | |
f7bd2698 | 715 | Returns the last character. |
a660d684 | 716 | |
f7bd2698 | 717 | \func{char\&}{Last}{\void} |
a660d684 | 718 | |
f7bd2698 | 719 | Returns a reference to the last character (writable). |
a660d684 | 720 | |
f7bd2698 JS |
721 | \membersection{wxString::Left}\label{wxstringleft} |
722 | ||
723 | \constfunc{wxString}{Left}{\param{size\_t}{ count}} | |
724 | ||
725 | Returns the first {\it count} characters. | |
726 | ||
727 | \constfunc{wxString}{Left}{\param{char}{ ch}} | |
728 | ||
729 | Returns all characters before the first occurence of {\it ch}. | |
730 | Returns the whole string if {\it ch} is not found. | |
a660d684 | 731 | |
f7bd2698 | 732 | \membersection{wxString::Len}\label{wxstringlen} |
a660d684 | 733 | |
f7bd2698 JS |
734 | \constfunc{size\_t}{Len}{\void} |
735 | ||
736 | Returns the length of the string. | |
737 | ||
738 | \membersection{wxString::Length}\label{wxstringlength} | |
739 | ||
740 | \constfunc{size\_t}{Length}{\void} | |
741 | ||
742 | Returns the length of the string (same as Len). | |
a660d684 | 743 | |
99f09bc1 VZ |
744 | \membersection{wxString::Lower}\label{wxstringlower} |
745 | ||
746 | \constfunc{wxString}{Lower}{\void} | |
747 | ||
748 | Returns this string converted to the lower case. | |
749 | ||
750 | \membersection{wxString::LowerCase}\label{wxstringlowercase} | |
a660d684 | 751 | |
f7bd2698 JS |
752 | \func{void}{LowerCase}{\void} |
753 | ||
754 | Same as MakeLower. | |
755 | ||
756 | \membersection{wxString::MakeLower}\label{wxstringmakelower} | |
757 | ||
758 | \func{void}{MakeLower}{\void} | |
759 | ||
760 | Converts all characters to lower case. | |
761 | ||
762 | \membersection{wxString::MakeUpper}\label{wxstringmakeupper} | |
763 | ||
764 | \func{void}{MakeUpper}{\void} | |
765 | ||
766 | Converts all characters to upper case. | |
a660d684 | 767 | |
99f09bc1 | 768 | \membersection{wxString::Matches}\label{wxstringmatches} |
a660d684 | 769 | |
f7bd2698 JS |
770 | \constfunc{bool}{Matches}{\param{const char*}{ szMask}} |
771 | ||
772 | Returns TRUE if the string contents matches a mask containing '*' and '?'. | |
a660d684 | 773 | |
f7bd2698 | 774 | \membersection{wxString::Mid}\label{wxstringmid} |
a660d684 | 775 | |
99f09bc1 | 776 | \constfunc{wxString}{Mid}{\param{size\_t}{ first}, \param{size\_t}{ count = wxSTRING\_MAXLEN}} |
a660d684 | 777 | |
f7bd2698 JS |
778 | Returns a substring starting at {\it first}, with length {\it count}, or the rest of |
779 | the string if {\it count} is the default value. | |
780 | ||
781 | \membersection{wxString::Pad}\label{wxstringpad} | |
782 | ||
783 | \func{wxString\&}{Pad}{\param{size\_t}{ count}, \param{char}{ pad = ' '}, \param{bool}{ fromRight = TRUE}} | |
784 | ||
785 | Adds {\it count} copies of {\it pad} to the beginning, or to the end of the string (the default). | |
786 | ||
787 | Removes spaces from the left or from the right (default). | |
a660d684 | 788 | |
99f09bc1 | 789 | \membersection{wxString::Prepend}\label{wxstringprepend} |
a660d684 | 790 | |
f7bd2698 | 791 | \func{wxString\&}{Prepend}{\param{const wxString\&}{ str}} |
a660d684 | 792 | |
f7bd2698 | 793 | Prepends {\it str} to this string, returning a reference to this string. |
a660d684 | 794 | |
f7bd2698 | 795 | \membersection{wxString::Printf}\label{wxstringprintf} |
a660d684 | 796 | |
f7bd2698 JS |
797 | \func{int}{Printf}{\param{const char* }{pszFormat}, \param{}{...}} |
798 | ||
99f09bc1 VZ |
799 | Similar to the standard function {\it sprintf()}. Returns the number of |
800 | characters written, or an integer less than zero on error. | |
801 | ||
802 | {\bf NB:} This function will use a safe version of {\it vsprintf()} (usually called | |
803 | {\it vsnprintf()}) whenever available to always allocate the buffer of correct | |
804 | size. Unfortunately, this function is not available on all platforms and the | |
805 | dangerous {\it vsprintf()} will be used then which may lead to buffer overflows. | |
a660d684 | 806 | |
f7bd2698 JS |
807 | \membersection{wxString::PrintfV}\label{wxstringprintfv} |
808 | ||
809 | \func{int}{PrintfV}{\param{const char* }{pszFormat}, \param{va\_list}{ argPtr}} | |
810 | ||
811 | Similar to vprintf. Returns the number of characters written, or an integer less than zero | |
812 | on error. | |
a660d684 | 813 | |
99f09bc1 | 814 | \membersection{wxString::Remove}\label{wxstringremove} |
a660d684 | 815 | |
f7bd2698 JS |
816 | \func{wxString\&}{Remove}{\param{size\_t}{ pos}} |
817 | ||
818 | Same as Truncate. Removes the portion from {\it pos} to the end of the string. | |
819 | ||
820 | \func{wxString\&}{Remove}{\param{size\_t}{ pos}, \param{size\_t}{ len}} | |
821 | ||
42d14d4e | 822 | Removes the {\it len} characters from the string, starting at {\it pos}. |
f7bd2698 JS |
823 | |
824 | \membersection{wxString::RemoveLast}\label{wxstringremovelast} | |
a660d684 | 825 | |
f7bd2698 JS |
826 | \func{wxString\&}{RemoveLast}{\void} |
827 | ||
828 | Removes the last character. | |
a660d684 | 829 | |
99f09bc1 | 830 | \membersection{wxString::Replace}\label{wxstringreplace} |
a660d684 | 831 | |
99f09bc1 | 832 | \func{size\_t}{Replace}{\param{const char*}{ szOld}, \param{const char*}{ szNew}, \param{bool}{ replaceAll = TRUE}} |
f7bd2698 JS |
833 | |
834 | Replace first (or all) occurences of substring with another one. | |
835 | ||
836 | {\it replaceAll}: global replace (default), or only the first occurence. | |
837 | ||
838 | Returns the number of replacements made. | |
839 | ||
840 | \membersection{wxString::Right}\label{wxstringright} | |
841 | ||
842 | \constfunc{wxString}{Right}{\param{size\_t}{ count}} | |
a660d684 | 843 | |
f7bd2698 | 844 | Returns the last {\it count} characters. |
a660d684 | 845 | |
f7bd2698 | 846 | \membersection{wxString::SetChar}\label{wxstringsetchar} |
a660d684 | 847 | |
f7bd2698 JS |
848 | \func{void}{SetChar}{\param{size\_t}{ n}, \param{char}{ch}} |
849 | ||
850 | Sets the character at position {\it n}. | |
851 | ||
852 | \membersection{wxString::Shrink}\label{wxstringshrink} | |
853 | ||
854 | \func{void}{Shrink}{\void} | |
855 | ||
99f09bc1 VZ |
856 | Minimizes the string's memory. This can be useful after a call to |
857 | \helpref{Alloc()}{wxstringalloc} if too much memory were preallocated. | |
a660d684 KB |
858 | |
859 | \membersection{wxString::sprintf}\label{wxstringsprintf} | |
a660d684 | 860 | |
f7bd2698 | 861 | \func{void}{sprintf}{\param{const char* }{ fmt}} |
a660d684 | 862 | |
f7bd2698 | 863 | The same as Printf. |
a660d684 | 864 | |
99f09bc1 | 865 | \membersection{wxString::Strip}\label{wxstringstrip} |
a660d684 KB |
866 | |
867 | \begin{verbatim} | |
f7bd2698 | 868 | enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; |
a660d684 KB |
869 | \end{verbatim} |
870 | ||
f7bd2698 | 871 | \constfunc{wxString}{Strip}{\param{stripType}{ s = trailing}} |
a660d684 | 872 | |
f7bd2698 JS |
873 | Strip characters at the front and/or end. The same as Trim except that it |
874 | doesn't change this string. | |
a660d684 | 875 | |
99f09bc1 VZ |
876 | \membersection{wxString::SubString}\label{wxstringsubstring} |
877 | ||
878 | \constfunc{wxString}{SubString}{\param{size\_t}{ to}, \param{size\_t}{ from}} | |
879 | ||
880 | Same as \helpref{Mid}{wxstringmid}. | |
881 | ||
cd0b1709 VZ |
882 | \membersection{wxString::ToDouble}\label{wxstringtodouble} |
883 | ||
1845534d | 884 | \constfunc{bool}{To}{\param{double}{ *val}} |
cd0b1709 VZ |
885 | |
886 | Attempts to convert the string to a floating point number. Returns TRUE on | |
887 | suceess (the number is stored in the location pointed to by {\it val}) or FALSE | |
888 | if the string does not represent such number. | |
889 | ||
890 | \membersection{wxString::ToLong}\label{wxstringtolong} | |
891 | ||
1845534d | 892 | \constfunc{bool}{To}{\param{long}{ *val}} |
cd0b1709 VZ |
893 | |
894 | Attempts to convert the string to a signed integer. Returns TRUE on suceess | |
895 | (the number is stored in the location pointed to by {\it val}) or FALSE if the | |
896 | string does not represent such number. | |
897 | ||
898 | \membersection{wxString::ToULong}\label{wxstringtoulong} | |
899 | ||
1845534d | 900 | \constfunc{bool}{To}{\param{unsigned long}{ *val}} |
cd0b1709 VZ |
901 | |
902 | Attempts to convert the string to an unsigned integer. Returns TRUE on suceess | |
903 | (the number is stored in the location pointed to by {\it val}) or FALSE if the | |
904 | string does not represent such number. | |
905 | ||
f7bd2698 | 906 | \membersection{wxString::Trim}\label{wxstringtrim} |
a660d684 | 907 | |
f7bd2698 | 908 | \func{wxString\&}{Trim}{\param{bool}{ fromRight = TRUE}} |
a660d684 | 909 | |
f7bd2698 | 910 | Removes spaces from the left or from the right (default). |
a660d684 | 911 | |
f7bd2698 | 912 | \membersection{wxString::Truncate}\label{wxstringtruncate} |
a660d684 | 913 | |
f7bd2698 | 914 | \func{wxString\&}{Truncate}{\param{size\_t}{ len}} |
a660d684 | 915 | |
f7bd2698 | 916 | Truncate the string to the given length. |
a660d684 | 917 | |
f7bd2698 JS |
918 | \membersection{wxString::UngetWriteBuf}\label{wxstringungetwritebuf} |
919 | ||
920 | \func{void}{UngetWriteBuf}{\void} | |
921 | ||
922 | Puts the string back into a reasonable state, after | |
923 | \rtfsp\helpref{wxString::GetWriteBuf}{wxstringgetwritebuf} was called. | |
a660d684 | 924 | |
99f09bc1 VZ |
925 | \membersection{wxString::Upper}\label{wxstringupper} |
926 | ||
927 | \constfunc{wxString}{Upper}{\void} | |
928 | ||
929 | Returns this string converted to upper case. | |
930 | ||
931 | \membersection{wxString::UpperCase}\label{wxstringuppercase} | |
a660d684 | 932 | |
f7bd2698 JS |
933 | \func{void}{UpperCase}{\void} |
934 | ||
935 | The same as MakeUpper. | |
a660d684 | 936 | |
99f09bc1 VZ |
937 | \membersection{wxString::operator!}\label{wxstringoperatornot} |
938 | ||
939 | \constfunc{bool}{operator!}{\void} | |
940 | ||
941 | Empty string is FALSE, so !string will only return TRUE if the string is empty. | |
942 | This allows the tests for NULLness of a {\it const char *} pointer and emptyness | |
943 | of the string to look the same in the code and makes it easier to port old code | |
944 | to wxString. | |
945 | ||
946 | See also \helpref{IsEmpty()}{wxstringisempty}. | |
947 | ||
a660d684 KB |
948 | \membersection{wxString::operator $=$}\label{wxstringoperatorassign} |
949 | ||
f7bd2698 JS |
950 | \func{wxString\&}{operator $=$}{\param{const wxString\&}{ str}} |
951 | ||
952 | \func{wxString\&}{operator $=$}{\param{const char*}{ psz}} | |
953 | ||
954 | \func{wxString\&}{operator $=$}{\param{char}{ c}} | |
955 | ||
956 | \func{wxString\&}{operator $=$}{\param{const unsigned char*}{ psz}} | |
957 | ||
958 | \func{wxString\&}{operator $=$}{\param{const wchar\_t*}{ pwz}} | |
a660d684 | 959 | |
99f09bc1 VZ |
960 | Assignment: the effect of each operation is the same as for the corresponding |
961 | constructor (see \helpref{wxString constructors}{wxstringconstruct}). | |
5de76427 JS |
962 | |
963 | \membersection{operator wxString::$+$}\label{wxstringoperatorplus} | |
964 | ||
99f09bc1 VZ |
965 | Concatenation: all these operators return a new strign equal to the sum of the |
966 | operands. | |
5de76427 JS |
967 | |
968 | \func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} | |
969 | ||
970 | \func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{const char*}{ y}} | |
971 | ||
972 | \func{wxString}{operator $+$}{\param{const wxString\&}{ x}, \param{char}{ y}} | |
973 | ||
974 | \func{wxString}{operator $+$}{\param{const char*}{ x}, \param{const wxString\&}{ y}} | |
975 | ||
99f09bc1 | 976 | \membersection{wxString::operator $+=$}\label{wxstringplusequal} |
a660d684 | 977 | |
f7bd2698 JS |
978 | \func{void}{operator $+=$}{\param{const wxString\&}{ str}} |
979 | ||
980 | \func{void}{operator $+=$}{\param{const char*}{ psz}} | |
981 | ||
982 | \func{void}{operator $+=$}{\param{char}{ c}} | |
a660d684 | 983 | |
99f09bc1 | 984 | Concatenation in place: the argument is appended to the string. |
a660d684 KB |
985 | |
986 | \membersection{wxString::operator []}\label{wxstringoperatorbracket} | |
987 | ||
f7bd2698 JS |
988 | \func{char\&}{operator []}{\param{size\_t}{ i}} |
989 | ||
990 | \func{char}{operator []}{\param{size\_t}{ i}} | |
991 | ||
992 | \func{char}{operator []}{\param{int}{ i}} | |
a660d684 KB |
993 | |
994 | Element extraction. | |
995 | ||
996 | \membersection{wxString::operator ()}\label{wxstringoperatorparenth} | |
997 | ||
f7bd2698 JS |
998 | \func{wxString}{operator ()}{\param{size\_t}{ start}, \param{size\_t}{ len}} |
999 | ||
1000 | Same as Mid (substring extraction). | |
a660d684 KB |
1001 | |
1002 | \membersection{wxString::operator \cinsert}\label{wxstringoperatorout} | |
f7bd2698 | 1003 | |
037267e1 | 1004 | \func{wxString\&}{operator \cinsert}{\param{const wxString\&}{ str}} |
f7bd2698 | 1005 | |
037267e1 | 1006 | \func{wxString\&}{operator \cinsert}{\param{const char*}{ psz}} |
f7bd2698 | 1007 | |
037267e1 | 1008 | \func{wxString\&}{operator \cinsert}{\param{char }{ch}} |
f7bd2698 JS |
1009 | |
1010 | Same as $+=$. | |
a660d684 | 1011 | |
99f09bc1 VZ |
1012 | \func{wxString\&}{operator \cinsert}{\param{int}{ i}} |
1013 | ||
1014 | \func{wxString\&}{operator \cinsert}{\param{float}{ f}} | |
1015 | ||
1016 | \func{wxString\&}{operator \cinsert}{\param{double}{ d}} | |
1017 | ||
1018 | These functions work as C++ stream insertion operators: they insert the given | |
1019 | value into the string. Precision or format cannot be set using them, you can use | |
1020 | \helpref{Printf}{wxstringprintf} for this. | |
1021 | ||
a660d684 | 1022 | \membersection{wxString::operator \cextract}\label{wxstringoperatorin} |
a660d684 | 1023 | |
f7bd2698 | 1024 | \func{friend istream\&}{operator \cextract}{\param{istream\&}{ is}, \param{wxString\&}{ str}} |
a660d684 | 1025 | |
f7bd2698 | 1026 | Extraction from a stream. |
a660d684 | 1027 | |
f7bd2698 | 1028 | \membersection{wxString::operator const char*}\label{wxstringoperatorconstcharpt} |
a660d684 | 1029 | |
f7bd2698 | 1030 | \constfunc{}{operator const char*}{\void} |
a660d684 | 1031 | |
f7bd2698 | 1032 | Implicit conversion to a C string. |
a660d684 | 1033 | |
99f09bc1 | 1034 | \membersection{Comparison operators}\label{wxstringcomparison} |
a660d684 | 1035 | |
f7bd2698 | 1036 | \func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1037 | |
f7bd2698 | 1038 | \func{bool}{operator $==$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1039 | |
f7bd2698 | 1040 | \func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1041 | |
f7bd2698 | 1042 | \func{bool}{operator $!=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1043 | |
f7bd2698 | 1044 | \func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1045 | |
f7bd2698 | 1046 | \func{bool}{operator $>$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1047 | |
f7bd2698 | 1048 | \func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1049 | |
f7bd2698 | 1050 | \func{bool}{operator $>=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1051 | |
f7bd2698 | 1052 | \func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1053 | |
f7bd2698 | 1054 | \func{bool}{operator $<$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1055 | |
f7bd2698 | 1056 | \func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const wxString\&}{ y}} |
a660d684 | 1057 | |
f7bd2698 | 1058 | \func{bool}{operator $<=$}{\param{const wxString\&}{ x}, \param{const char*}{ t}} |
a660d684 | 1059 | |
f7bd2698 | 1060 | \wxheading{Remarks} |
a660d684 | 1061 | |
f7bd2698 | 1062 | These comparisons are case-sensitive. |
a660d684 | 1063 |