1 \section{\class{wxString
}}\label{wxstring
}
3 \wxheading{Derived from
}
7 \wxheading{Include files
}
13 \overview{Overview
}{wxstringoverview
}
15 \latexignore{\rtfignore{\wxheading{Members
}}}
17 \membersection{wxString::wxString
}\label{wxstringconstruct
}
19 \func{}{wxString
}{\void}
23 \func{}{wxString
}{\param{const wxString\&
}{ x
}}
27 \func{}{wxString
}{\param{char
}{ ch
},
\param{size
\_t}{ n =
1}}
29 Constructs a string of
{\it n
} copies of character
{\it ch
}.
31 \func{}{wxString
}{\param{const char*
}{ psz
},
\param{size
\_t}{ nLength = STRING
\_MAXLEN}}
33 Takes first
{\it nLength
} characters from the C string
{\it psz
}.
34 The default value of STRING
\_MAXLEN means take all the string.
36 \func{}{wxString
}{\param{const unsigned char*
}{ psz
},
\param{size
\_t}{ nLength = STRING
\_MAXLEN}}
38 For compilers using unsigned char: takes first
{\it nLength
} characters from the C string
{\it psz
}.
39 The default value of STRING
\_MAXLEN means take all the string.
41 \func{}{wxString
}{\param{const wchar
\_t*
}{ psz
}}
43 Constructs a string from the wide (UNICODE) string.
45 \membersection{wxString::
\destruct{wxString
}}\label{wxstringdestruct
}
47 \func{}{\destruct{wxString
}}{\void}
49 String destructor. Note that this is not virtual, so wxString must not be inherited from.
51 \membersection{wxString::Alloc
}\label{wxstringAlloc
}
53 \func{void
}{Alloc
}{\param{uint
}{ newsize
}}
55 Preallocate some space for wxString. Only works if the data of this string is not shared.
57 \membersection{wxString::Append
}\label{wxstringAppend
}
59 \func{wxString\&
}{Append
}{\param{const char*
}{ psz
}}
61 Concatenates
{\it psz
} to this string, returning a reference to it.
63 \func{wxString\&
}{Append
}{\param{char
}{ ch
},
\param{int
}{ count =
1}}
65 Concatenates character
{\it ch
} to this string,
{\it count
} times, returning a reference
68 \membersection{wxString::After
}\label{wxstringAfter
}
70 \constfunc{wxString
}{After
}{\param{char
}{ ch
}}
72 Gets all the characters after the first occurence of
{\it ch
}.
73 Returns the empty string if
{\it ch
} is not found.
75 \membersection{wxString::Before
}\label{wxstringBefore
}
77 \constfunc{wxString
}{Before
}{\param{char
}{ ch
}}
79 Gets all characters before the last occurence of
{\it ch
}.
80 Returns empty string if
{\it ch
} is not found.
82 \membersection{wxString::Cmp
}\label{wxstringcmp
}
84 \constfunc{int
}{Cmp
}{\param{const char*
}{ psz
}}
86 Case-sensitive comparison.
88 Returns
0 if equal, +
1 if greater or -
1 if less.
90 See also CmpNoCase, IsSameAs.
92 \membersection{wxString::CmpNoCase
}\label{wxstringcmpnocase
}
94 \constfunc{int
}{CmpNoCase
}{\param{const char*
}{ psz
}}
96 Case-insensitive comparison.
98 Returns
0 if equal, +
1 if greater or -
1 if less.
100 See also Cmp, IsSameAs.
102 \membersection{wxString::CompareTo
}\label{wxstringCompareTo
}
105 #define NO_POS ((int)(-
1)) // undefined position
106 enum caseCompare
{exact, ignoreCase
};
109 \constfunc{int
}{CompareTo
}{\param{const char*
}{ psz
},
\param{caseCompare
}{ cmp = exact
}}
111 Case-sensitive comparison. Returns
0 if equal,
1 if greater or -
1 if less.
113 \membersection{wxString::Contains
}\label{wxstringContains
}
115 \func{bool
}{Contains
}{\param{const wxString\&
}{ str
}}
117 Returns
1 if target appears anyhere in wxString; else
0.
119 \membersection{wxString::Empty
}\label{wxstringempty
}
121 \func{void
}{Empty
}{\void}
123 Reinitializes the string and frees the data.
125 \membersection{wxString::Find
}\label{wxstringfind
}
127 \constfunc{int
}{Find
}{\param{char
}{ ch
},
\param{bool
}{ fromEnd = FALSE
}}
129 Searches for the given character. Returns the starting index, or -
1 if not found.
131 \constfunc{int
}{Find
}{\param{const char*
}{ sz
}}
133 Searches for the given string. Returns the starting index, or -
1 if not found.
135 \membersection{wxString::First
}\label{wxstringfirst
}
137 \func{size
\_t}{First
}{\param{char
}{ c
}}
139 \constfunc{size
\_t}{First
}{\param{const char*
}{ psz
}}
141 \constfunc{size
\_t}{First
}{\param{const wxString\&
}{ str
}}
143 \constfunc{size
\_t}{First
}{\param{const char
}{ ch
}}
145 Returns the first occurrence of the item.
147 \membersection{wxString::GetChar
}\label{wxstringgetchar
}
149 \constfunc{char
}{GetChar
}{\param{size
\_t}{ n
}}
151 Returns the character at position
{\it n
} (read-only).
153 \membersection{wxString::GetData
}\label{wxstringGetData
}
155 \constfunc{const char*
}{GetData
}{\void}
157 wxWindows compatibility conversion. Returns a constant pointer to the data in the string.
159 \membersection{wxString::GetWritableChar
}\label{wxstringgetwritablechar
}
161 \func{char\&
}{GetWritableChar
}{\param{size
\_t}{ n
}}
163 Returns a reference to the character at position
{\it n
}.
165 \membersection{wxString::GetWriteBuf
}\label{wxstringgetwritebuf
}
167 \func{char*
}{GetWriteBuf
}{\param{uint
}{ len
}}
169 Returns a writable buffer of at least
{\it len
} bytes.
171 Call
\helpref{wxString::UngetWriteBuf
}{wxstringungetwritebuf
} as soon as possible
172 to put the string back into a reasonable state.
174 \membersection{wxString::Index
}\label{wxstringIndex
}
176 \constfunc{size
\_t}{Index
}{\param{char
}{ ch
},
\param{int
}{ startpos =
0}}
178 Same as
\helpref{wxString::Find
}{wxstringfind
}.
180 \constfunc{size
\_t}{Index
}{\param{const char*
}{ sz
}}
182 Same as
\helpref{wxString::Find
}{wxstringfind
}.
184 \constfunc{size
\_t}{Index
}{\param{const char*
}{ sz
},
\param{bool
}{ caseSensitive = TRUE
},
\param{bool
}{ fromEnd = FALSE
}}
186 Search the element in the array, starting from either side.
188 If
{\it fromEnd
} is TRUE, reverse search direction.
190 If
{\bf caseSensitive
}, comparison is case sensitive (the default).
192 Returns the index of the first item matched, or NOT
\_FOUND.
195 %\membersection{wxString::insert}\label{wxstringinsert}
197 %\func{void}{insert}{\param{const wxString\&}{ str}, \param{uint}{ index}}
199 %Add new element at the given position.
201 \membersection{wxString::IsAscii
}\label{wxstringIsAscii
}
203 \constfunc{bool
}{IsAscii
}{\void}
205 Returns TRUE if the string is ASCII.
207 \membersection{wxString::IsEmpty
}\label{wxstringisempty
}
209 \constfunc{bool
}{IsEmpty
}{\void}
211 Returns TRUE if the string is NULL.
213 \membersection{wxString::IsNull
}\label{wxstringIsNull
}
215 \constfunc{bool
}{IsNull
}{\void}
217 Returns TRUE if the string is NULL (same as IsEmpty).
219 \membersection{wxString::IsNumber
}\label{wxstringIsNumber
}
221 \constfunc{bool
}{IsNumber
}{\void}
223 Returns TRUE if the string is a number.
225 \membersection{wxString::IsSameAs
}\label{wxstringissameas
}
227 \constfunc{bool
}{IsSameAs
}{\param{const char*
}{ psz
},
\param{bool
}{ caseSensitive = TRUE
}}
229 Test for string equality, case-sensitive (default) or not.
231 caseSensitive is TRUE by default (case matters).
233 Returns TRUE if strings are equal, FALSE otherwise.
235 See also Cmp, CmpNoCase.
237 \membersection{wxString::IsWord
}\label{wxstringIsWord
}
239 \constfunc{bool
}{IsWord
}{\void}
241 Returns TRUE if the string is a word. TODO: what's the definition of a word?
243 \membersection{wxString::Last
}\label{wxstringLast
}
245 \constfunc{char
}{Last
}{\void}
247 Returns the last character.
249 \func{char\&
}{Last
}{\void}
251 Returns a reference to the last character (writable).
253 \membersection{wxString::Left
}\label{wxstringleft
}
255 \constfunc{wxString
}{Left
}{\param{size
\_t}{ count
}}
257 Returns the first
{\it count
} characters.
259 \constfunc{wxString
}{Left
}{\param{char
}{ ch
}}
261 Returns all characters before the first occurence of
{\it ch
}.
262 Returns the whole string if
{\it ch
} is not found.
264 \membersection{wxString::Len
}\label{wxstringlen
}
266 \constfunc{size
\_t}{Len
}{\void}
268 Returns the length of the string.
270 \membersection{wxString::Length
}\label{wxstringlength
}
272 \constfunc{size
\_t}{Length
}{\void}
274 Returns the length of the string (same as Len).
276 \membersection{wxString::LowerCase
}\label{wxstringLowerCase
}
278 \func{void
}{LowerCase
}{\void}
282 \membersection{wxString::MakeLower
}\label{wxstringmakelower
}
284 \func{void
}{MakeLower
}{\void}
286 Converts all characters to lower case.
288 \membersection{wxString::MakeUpper
}\label{wxstringmakeupper
}
290 \func{void
}{MakeUpper
}{\void}
292 Converts all characters to upper case.
294 \membersection{wxString::Matches
}\label{wxstringMatches
}
296 \constfunc{bool
}{Matches
}{\param{const char*
}{ szMask
}}
298 Returns TRUE if the string contents matches a mask containing '*' and '?'.
300 \membersection{wxString::Mid
}\label{wxstringmid
}
302 \constfunc{wxString
}{Mid
}{\param{size
\_t}{ first
},
\param{size
\_t}{ count = STRING
\_MAXLEN}}
304 Returns a substring starting at
{\it first
}, with length
{\it count
}, or the rest of
305 the string if
{\it count
} is the default value.
307 \membersection{wxString::Pad
}\label{wxstringpad
}
309 \func{wxString\&
}{Pad
}{\param{size
\_t}{ count
},
\param{char
}{ pad = ' '
},
\param{bool
}{ fromRight = TRUE
}}
311 Adds
{\it count
} copies of
{\it pad
} to the beginning, or to the end of the string (the default).
313 Removes spaces from the left or from the right (default).
315 \membersection{wxString::Prepend
}\label{wxstringPrepend
}
317 \func{wxString\&
}{Prepend
}{\param{const wxString\&
}{ str
}}
319 Prepends
{\it str
} to this string, returning a reference to this string.
321 \membersection{wxString::Printf
}\label{wxstringprintf
}
323 \func{int
}{Printf
}{\param{const char*
}{pszFormat
},
\param{}{...
}}
325 Similar to sprintf. Returns the number of characters written, or an integer less than zero
328 \membersection{wxString::PrintfV
}\label{wxstringprintfv
}
330 \func{int
}{PrintfV
}{\param{const char*
}{pszFormat
},
\param{va
\_list}{ argPtr
}}
332 Similar to vprintf. Returns the number of characters written, or an integer less than zero
335 \membersection{wxString::Remove
}\label{wxstringRemove
}
337 \func{wxString\&
}{Remove
}{\param{size
\_t}{ pos
}}
339 Same as Truncate. Removes the portion from
{\it pos
} to the end of the string.
341 \func{wxString\&
}{Remove
}{\param{size
\_t}{ pos
},
\param{size
\_t}{ len
}}
343 Removes the last
{\it len
} characters from the string, starting at
{\it pos
}.
345 \membersection{wxString::RemoveLast
}\label{wxstringremovelast
}
347 \func{wxString\&
}{RemoveLast
}{\void}
349 Removes the last character.
351 \membersection{wxString::Replace
}\label{wxstringReplace
}
353 \func{uint
}{Replace
}{\param{const char*
}{ szOld
},
\param{const char*
}{ szNew
},
\param{bool
}{ replaceAll
}}
355 Replace first (or all) occurences of substring with another one.
357 {\it replaceAll
}: global replace (default), or only the first occurence.
359 Returns the number of replacements made.
361 \membersection{wxString::Right
}\label{wxstringright
}
363 \constfunc{wxString
}{Right
}{\param{size
\_t}{ count
}}
365 Returns the last
{\it count
} characters.
367 \constfunc{wxString
}{Right
}{\param{char
}{ ch
}}
369 Returns all characters after the last occurence of
{\it ch
}.
370 Returns the whole string if
{\it ch
} is not found.
372 \membersection{wxString::SetChar
}\label{wxstringsetchar
}
374 \func{void
}{SetChar
}{\param{size
\_t}{ n
},
\param{char
}{ch
}}
376 Sets the character at position
{\it n
}.
378 \membersection{wxString::Shrink
}\label{wxstringshrink
}
380 \func{void
}{Shrink
}{\void}
382 Minimizes the string's memory. Only works if the data of this string is not shared.
384 \membersection{wxString::sprintf
}\label{wxstringsprintf
}
386 \func{void
}{sprintf
}{\param{const char*
}{ fmt
}}
390 \membersection{wxString::Strip
}\label{wxstringStrip
}
393 enum stripType
{leading =
0x1, trailing =
0x2, both =
0x3};
396 \constfunc{wxString
}{Strip
}{\param{stripType
}{ s = trailing
}}
398 Strip characters at the front and/or end. The same as Trim except that it
399 doesn't change this string.
401 \membersection{wxString::Trim
}\label{wxstringtrim
}
403 \func{wxString\&
}{Trim
}{\param{bool
}{ fromRight = TRUE
}}
405 Removes spaces from the left or from the right (default).
407 \membersection{wxString::Truncate
}\label{wxstringtruncate
}
409 \func{wxString\&
}{Truncate
}{\param{size
\_t}{ len
}}
411 Truncate the string to the given length.
413 \membersection{wxString::UngetWriteBuf
}\label{wxstringungetwritebuf
}
415 \func{void
}{UngetWriteBuf
}{\void}
417 Puts the string back into a reasonable state, after
418 \rtfsp\helpref{wxString::GetWriteBuf
}{wxstringgetwritebuf
} was called.
420 \membersection{wxString::UpperCase
}\label{wxstringUpperCase
}
422 \func{void
}{UpperCase
}{\void}
424 The same as MakeUpper.
426 \membersection{wxString::operator $=$
}\label{wxstringoperatorassign
}
428 \func{wxString\&
}{operator $=$
}{\param{const wxString\&
}{ str
}}
430 \func{wxString\&
}{operator $=$
}{\param{const char*
}{ psz
}}
432 \func{wxString\&
}{operator $=$
}{\param{char
}{ c
}}
434 \func{wxString\&
}{operator $=$
}{\param{const unsigned char*
}{ psz
}}
436 \func{wxString\&
}{operator $=$
}{\param{const wchar
\_t*
}{ pwz
}}
440 \membersection{operator wxString::$+$
}\label{wxstringoperatorplus
}
444 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
446 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ y
}}
448 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{char
}{ y
}}
450 \func{wxString
}{operator $+$
}{\param{const char*
}{ x
},
\param{const wxString\&
}{ y
}}
452 \membersection{wxString::operator $+=$
}\label{wxstringPlusEqual
}
454 \func{void
}{operator $+=$
}{\param{const wxString\&
}{ str
}}
456 \func{void
}{operator $+=$
}{\param{const char*
}{ psz
}}
458 \func{void
}{operator $+=$
}{\param{char
}{ c
}}
462 \membersection{wxString::operator
[]}\label{wxstringoperatorbracket
}
464 \func{char\&
}{operator
[]}{\param{size
\_t}{ i
}}
466 \func{char
}{operator
[]}{\param{size
\_t}{ i
}}
468 \func{char
}{operator
[]}{\param{int
}{ i
}}
472 \membersection{wxString::operator ()
}\label{wxstringoperatorparenth
}
474 \func{wxString
}{operator ()
}{\param{size
\_t}{ start
},
\param{size
\_t}{ len
}}
476 Same as Mid (substring extraction).
478 \membersection{wxString::operator
\cinsert}\label{wxstringoperatorout
}
480 \func{wxString\&
}{operator
\cinsert}{\
\param{const wxString\&
}{ str
}}
482 \func{wxString\&
}{operator
\cinsert}{\
\param{const char*
}{ psz
}}
484 \func{wxString\&
}{operator
\cinsert}{\
\param{char
}{ch
}}
488 \membersection{wxString::operator
\cextract}\label{wxstringoperatorin
}
490 \func{friend istream\&
}{operator
\cextract}{\param{istream\&
}{ is
},
\param{wxString\&
}{ str
}}
492 Extraction from a stream.
494 \membersection{wxString::operator const char*
}\label{wxstringoperatorconstcharpt
}
496 \constfunc{}{operator const char*
}{\void}
498 Implicit conversion to a C string.
500 \membersection{Comparison operators
}\label{wxstringComparison
}
502 \func{bool
}{operator $==$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
504 \func{bool
}{operator $==$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
506 \func{bool
}{operator $!=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
508 \func{bool
}{operator $!=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
510 \func{bool
}{operator $>$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
512 \func{bool
}{operator $>$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
514 \func{bool
}{operator $>=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
516 \func{bool
}{operator $>=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
518 \func{bool
}{operator $<$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
520 \func{bool
}{operator $<$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
522 \func{bool
}{operator $<=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
524 \func{bool
}{operator $<=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
528 These comparisons are case-sensitive.