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