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.
190 \membersection{wxString::Insert
}\label{wxstringInsert
}
192 \func{void
}{Insert
}{\param{const wxString\&
}{ str
},
\param{uint
}{ index
}}
194 Add new element at the given position.
196 \membersection{wxString::IsAscii
}\label{wxstringIsAscii
}
198 \constfunc{bool
}{IsAscii
}{\void}
200 Returns TRUE if the string is ASCII.
202 \membersection{wxString::IsEmpty
}\label{wxstringisempty
}
204 \constfunc{bool
}{IsEmpty
}{\void}
206 Returns TRUE if the string is NULL.
208 \membersection{wxString::IsNull
}\label{wxstringIsNull
}
210 \constfunc{bool
}{IsNull
}{\void}
212 Returns TRUE if the string is NULL (same as IsEmpty).
214 \membersection{wxString::IsNumber
}\label{wxstringIsNumber
}
216 \constfunc{bool
}{IsNumber
}{\void}
218 Returns TRUE if the string is a number.
220 \membersection{wxString::IsSameAs
}\label{wxstringissameas
}
222 \constfunc{bool
}{IsSameAs
}{\param{const char*
}{ psz
},
\param{bool
}{ caseSensitive = TRUE
}}
224 Test for string equality, case-sensitive (default) or not.
226 caseSensitive is TRUE by default (case matters).
228 Returns TRUE if strings are equal, FALSE otherwise.
230 See also Cmp, CmpNoCase.
232 \membersection{wxString::IsWord
}\label{wxstringIsWord
}
234 \constfunc{bool
}{IsWord
}{\void}
236 Returns TRUE if the string is a word. TODO: what's the definition of a word?
238 \membersection{wxString::Last
}\label{wxstringLast
}
240 \constfunc{char
}{Last
}{\void}
242 Returns the last character.
244 \func{char\&
}{Last
}{\void}
246 Returns a reference to the last character (writable).
248 \membersection{wxString::Left
}\label{wxstringleft
}
250 \constfunc{wxString
}{Left
}{\param{size
\_t}{ count
}}
252 Returns the first
{\it count
} characters.
254 \constfunc{wxString
}{Left
}{\param{char
}{ ch
}}
256 Returns all characters before the first occurence of
{\it ch
}.
257 Returns the whole string if
{\it ch
} is not found.
259 \membersection{wxString::Len
}\label{wxstringlen
}
261 \constfunc{size
\_t}{Len
}{\void}
263 Returns the length of the string.
265 \membersection{wxString::Length
}\label{wxstringlength
}
267 \constfunc{size
\_t}{Length
}{\void}
269 Returns the length of the string (same as Len).
271 \membersection{wxString::LowerCase
}\label{wxstringLowerCase
}
273 \func{void
}{LowerCase
}{\void}
277 \membersection{wxString::MakeLower
}\label{wxstringmakelower
}
279 \func{void
}{MakeLower
}{\void}
281 Converts all characters to lower case.
283 \membersection{wxString::MakeUpper
}\label{wxstringmakeupper
}
285 \func{void
}{MakeUpper
}{\void}
287 Converts all characters to upper case.
289 \membersection{wxString::Matches
}\label{wxstringMatches
}
291 \constfunc{bool
}{Matches
}{\param{const char*
}{ szMask
}}
293 Returns TRUE if the string contents matches a mask containing '*' and '?'.
295 \membersection{wxString::Mid
}\label{wxstringmid
}
297 \constfunc{wxString
}{Mid
}{\param{size
\_t}{ first
},
\param{size
\_t}{ count = STRING
\_MAXLEN}}
299 Returns a substring starting at
{\it first
}, with length
{\it count
}, or the rest of
300 the string if
{\it count
} is the default value.
302 \membersection{wxString::Pad
}\label{wxstringpad
}
304 \func{wxString\&
}{Pad
}{\param{size
\_t}{ count
},
\param{char
}{ pad = ' '
},
\param{bool
}{ fromRight = TRUE
}}
306 Adds
{\it count
} copies of
{\it pad
} to the beginning, or to the end of the string (the default).
308 Removes spaces from the left or from the right (default).
310 \membersection{wxString::Prepend
}\label{wxstringPrepend
}
312 \func{wxString\&
}{Prepend
}{\param{const wxString\&
}{ str
}}
314 Prepends
{\it str
} to this string, returning a reference to this string.
316 \membersection{wxString::Printf
}\label{wxstringprintf
}
318 \func{int
}{Printf
}{\param{const char*
}{pszFormat
},
\param{}{...
}}
320 Similar to sprintf. Returns the number of characters written, or an integer less than zero
323 \membersection{wxString::PrintfV
}\label{wxstringprintfv
}
325 \func{int
}{PrintfV
}{\param{const char*
}{pszFormat
},
\param{va
\_list}{ argPtr
}}
327 Similar to vprintf. Returns the number of characters written, or an integer less than zero
330 \membersection{wxString::Remove
}\label{wxstringRemove
}
332 \func{wxString\&
}{Remove
}{\param{size
\_t}{ pos
}}
334 Same as Truncate. Removes the portion from
{\it pos
} to the end of the string.
336 \func{wxString\&
}{Remove
}{\param{size
\_t}{ pos
},
\param{size
\_t}{ len
}}
338 Removes the last
{\it len
} characters from the string, starting at
{\it pos
}.
340 \membersection{wxString::RemoveLast
}\label{wxstringremovelast
}
342 \func{wxString\&
}{RemoveLast
}{\void}
344 Removes the last character.
346 \membersection{wxString::Replace
}\label{wxstringReplace
}
348 \func{uint
}{Replace
}{\param{const char*
}{ szOld
},
\param{const char*
}{ szNew
},
\param{bool
}{ replaceAll
}}
350 Replace first (or all) occurences of substring with another one.
352 {\it replaceAll
}: global replace (default), or only the first occurence.
354 Returns the number of replacements made.
356 \membersection{wxString::Right
}\label{wxstringright
}
358 \constfunc{wxString
}{Right
}{\param{size
\_t}{ count
}}
360 Returns the last
{\it count
} characters.
362 \constfunc{wxString
}{Right
}{\param{char
}{ ch
}}
364 Returns all characters after the last occurence of
{\it ch
}.
365 Returns the whole string if
{\it ch
} is not found.
367 \membersection{wxString::SetChar
}\label{wxstringsetchar
}
369 \func{void
}{SetChar
}{\param{size
\_t}{ n
},
\param{char
}{ch
}}
371 Sets the character at position
{\it n
}.
373 \membersection{wxString::Shrink
}\label{wxstringshrink
}
375 \func{void
}{Shrink
}{\void}
377 Minimizes the string's memory. Only works if the data of this string is not shared.
379 \membersection{wxString::sprintf
}\label{wxstringsprintf
}
381 \func{void
}{sprintf
}{\param{const char*
}{ fmt
}}
385 \membersection{wxString::Strip
}\label{wxstringStrip
}
388 enum stripType
{leading =
0x1, trailing =
0x2, both =
0x3};
391 \constfunc{wxString
}{Strip
}{\param{stripType
}{ s = trailing
}}
393 Strip characters at the front and/or end. The same as Trim except that it
394 doesn't change this string.
396 \membersection{wxString::Trim
}\label{wxstringtrim
}
398 \func{wxString\&
}{Trim
}{\param{bool
}{ fromRight = TRUE
}}
400 Removes spaces from the left or from the right (default).
402 \membersection{wxString::Truncate
}\label{wxstringtruncate
}
404 \func{wxString\&
}{Truncate
}{\param{size
\_t}{ len
}}
406 Truncate the string to the given length.
408 \membersection{wxString::UngetWriteBuf
}\label{wxstringungetwritebuf
}
410 \func{void
}{UngetWriteBuf
}{\void}
412 Puts the string back into a reasonable state, after
413 \rtfsp\helpref{wxString::GetWriteBuf
}{wxstringgetwritebuf
} was called.
415 \membersection{wxString::UpperCase
}\label{wxstringUpperCase
}
417 \func{void
}{UpperCase
}{\void}
419 The same as MakeUpper.
421 \membersection{wxString::operator $=$
}\label{wxstringoperatorassign
}
423 \func{wxString\&
}{operator $=$
}{\param{const wxString\&
}{ str
}}
425 \func{wxString\&
}{operator $=$
}{\param{const char*
}{ psz
}}
427 \func{wxString\&
}{operator $=$
}{\param{char
}{ c
}}
429 \func{wxString\&
}{operator $=$
}{\param{const unsigned char*
}{ psz
}}
431 \func{wxString\&
}{operator $=$
}{\param{const wchar
\_t*
}{ pwz
}}
435 \membersection{wxString::operator $+=$
}\label{wxstringPlusEqual
}
437 \func{void
}{operator $+=$
}{\param{const wxString\&
}{ str
}}
439 \func{void
}{operator $+=$
}{\param{const char*
}{ psz
}}
441 \func{void
}{operator $+=$
}{\param{char
}{ c
}}
445 \membersection{wxString::operator
[]}\label{wxstringoperatorbracket
}
447 \func{char\&
}{operator
[]}{\param{size
\_t}{ i
}}
449 \func{char
}{operator
[]}{\param{size
\_t}{ i
}}
451 \func{char
}{operator
[]}{\param{int
}{ i
}}
455 \membersection{wxString::operator ()
}\label{wxstringoperatorparenth
}
457 \func{wxString
}{operator ()
}{\param{size
\_t}{ start
},
\param{size
\_t}{ len
}}
459 Same as Mid (substring extraction).
461 \membersection{wxString::operator
\cinsert}\label{wxstringoperatorout
}
463 \func{wxString\&
}{operator
\cinsert}{\
\param{const wxString\&
}{ str
}}
465 \func{wxString\&
}{operator
\cinsert}{\
\param{const char*
}{ psz
}}
467 \func{wxString\&
}{operator
\cinsert}{\
\param{char
}{ch
}}
471 \membersection{wxString::operator
\cextract}\label{wxstringoperatorin
}
473 \func{friend istream\&
}{operator
\cextract}{\param{istream\&
}{ is
},
\param{wxString\&
}{ str
}}
475 Extraction from a stream.
477 \membersection{wxString::operator const char*
}\label{wxstringoperatorconstcharpt
}
479 \constfunc{}{operator const char*
}{\void}
481 Implicit conversion to a C string.
483 \membersection{Comparison operators
}\label{wxstringComparison
}
485 \func{bool
}{operator $==$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
487 \func{bool
}{operator $==$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
489 \func{bool
}{operator $!=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
491 \func{bool
}{operator $!=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
493 \func{bool
}{operator $>$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
495 \func{bool
}{operator $>$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
497 \func{bool
}{operator $>=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
499 \func{bool
}{operator $>=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
501 \func{bool
}{operator $<$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
503 \func{bool
}{operator $<$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
505 \func{bool
}{operator $<=$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
507 \func{bool
}{operator $<=$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ t
}}
511 These comparisons are case-sensitive.
513 \membersection{operator $+$
}\label{wxstringoperatorplus
}
515 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{const wxString\&
}{ y
}}
517 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{const char*
}{ y
}}
519 \func{wxString
}{operator $+$
}{\param{const wxString\&
}{ x
},
\param{char
}{ y
}}
521 \func{wxString
}{operator $+$
}{\param{const char*
}{ x
},
\param{const wxString\&
}{ y
}}