📄 wxstring.tex
字号:
\membersection{wxString::Index}\label{wxstringindex}\constfunc{size\_t}{Index}{\param{wxChar}{ ch}}\constfunc{size\_t}{Index}{\param{const wxChar*}{ sz}}Same as \helpref{wxString::Find}{wxstringfind}.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::IsAscii}\label{wxstringisascii}\constfunc{bool}{IsAscii}{\void}Returns \true if the string contains only ASCII characters.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::IsEmpty}\label{wxstringisempty}\constfunc{bool}{IsEmpty}{\void}Returns \true if the string is empty.\membersection{wxString::IsNull}\label{wxstringisnull}\constfunc{bool}{IsNull}{\void}Returns \true if the string is empty (same as \helpref{IsEmpty}{wxstringisempty}).This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::IsNumber}\label{wxstringisnumber}\constfunc{bool}{IsNumber}{\void}Returns \true if the string is an integer (with possible sign).This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::IsSameAs}\label{wxstringissameas}\constfunc{bool}{IsSameAs}{\param{const wxChar*}{ psz}, \param{bool}{ caseSensitive = true}}Test for string equality, case-sensitive (default) or not.caseSensitive is \true by default (case matters).Returns \true if strings are equal, \false otherwise.See also \helpref{Cmp}{wxstringcmp}, \helpref{CmpNoCase}{wxstringcmpnocase}\constfunc{bool}{IsSameAs}{\param{wxChar}{ c}, \param{bool}{ caseSensitive = true}}Test whether the string is equal to the single character {\it c}. The test iscase-sensitive if {\it caseSensitive} is \true (default) or not if it is \false.Returns \true if the string is equal to the character, \false otherwise.See also \helpref{Cmp}{wxstringcmp}, \helpref{CmpNoCase}{wxstringcmpnocase}\membersection{wxString::IsWord}\label{wxstringisword}\constfunc{bool}{IsWord}{\void}Returns \true if the string is a word.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::Last}\label{wxstringlast}\constfunc{wxChar}{Last}{\void}Returns the last character.\func{wxChar\&}{Last}{\void}Returns a reference to the last character (writable).This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::Left}\label{wxstringleft}\constfunc{wxString}{Left}{\param{size\_t}{ count}}Returns the first {\it count} characters of the string.\membersection{wxString::Len}\label{wxstringlen}\constfunc{size\_t}{Len}{\void}Returns the length of the string.\membersection{wxString::Length}\label{wxstringlength}\constfunc{size\_t}{Length}{\void}Returns the length of the string (same as Len).This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::Lower}\label{wxstringlower}\constfunc{wxString}{Lower}{\void}Returns this string converted to the lower case.\membersection{wxString::LowerCase}\label{wxstringlowercase}\func{void}{LowerCase}{\void}Same as MakeLower.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::MakeLower}\label{wxstringmakelower}\func{wxString\&}{MakeLower}{\void}Converts all characters to lower case and returns the result.\membersection{wxString::MakeUpper}\label{wxstringmakeupper}\func{wxString\&}{MakeUpper}{\void}Converts all characters to upper case and returns the result.\membersection{wxString::Matches}\label{wxstringmatches}\constfunc{bool}{Matches}{\param{const wxChar*}{ szMask}}Returns \true if the string contents matches a mask containing '*' and '?'.\membersection{wxString::mb\_str}\label{wxstringmbstr}\constfunc{const char*}{mb\_str}{\param{wxMBConv\&}{ conv}}\constfunc{const wxCharBuffer}{mb\_str}{\param{wxMBConv\&}{ conv}}Returns multibyte (C string) representation of the string.In Unicode build, converts using \arg{conv}'s \helpref{cWC2MB}{wxmbconvcwc2mb}method and returns wxCharBuffer. In ANSI build, this function is sameas \helpref{c\_str}{wxstringcstr}.The macro wxWX2MBbuf is defined as the correct return type (without const).\wxheading{See also}\helpref{wxMBConv}{wxmbconv},\helpref{c\_str}{wxstringcstr}, \helpref{wc\_str}{wxstringwcstr},\helpref{fn\_str}{wxstringfnstr}\membersection{wxString::Mid}\label{wxstringmid}\constfunc{wxString}{Mid}{\param{size\_t}{ first}, \param{size\_t}{ count = wxSTRING\_MAXLEN}}Returns a substring starting at {\it first}, with length {\it count}, or the rest ofthe string if {\it count} is the default value.\membersection{wxString::Pad}\label{wxstringpad}\func{wxString\&}{Pad}{\param{size\_t}{ count}, \param{wxChar}{ pad = ' '}, \param{bool}{ fromRight = true}}Adds {\it count} copies of {\it pad} to the beginning, or to the end of the string (the default).Removes spaces from the left or from the right (default).\membersection{wxString::Prepend}\label{wxstringprepend}\func{wxString\&}{Prepend}{\param{const wxString\&}{ str}}Prepends {\it str} to this string, returning a reference to this string.\membersection{wxString::Printf}\label{wxstringprintf}\func{int}{Printf}{\param{const wxChar* }{pszFormat}, \param{}{...}}Similar to the standard function {\it sprintf()}. Returns the number ofcharacters written, or an integer less than zero on error.Note that if {\tt wxUSE\_PRINTF\_POS\_PARAMS} is set to 1, then this function supportsUnix98-style positional parameters:\begin{verbatim} wxString str; str.Printf(wxT("%d %d %d"), 1, 2, 3); // str now contains "1 2 3" str.Printf(wxT("%2$d %3$d %1$d"), 1, 2, 3); // str now contains "2 3 1"\end{verbatim}{\bf NB:} This function will use a safe version of {\it vsprintf()} (usually called {\it vsnprintf()}) whenever available to always allocate the buffer of correctsize. Unfortunately, this function is not available on all platforms and thedangerous {\it vsprintf()} will be used then which may lead to buffer overflows.\membersection{wxString::PrintfV}\label{wxstringprintfv}\func{int}{PrintfV}{\param{const wxChar* }{pszFormat}, \param{va\_list}{ argPtr}}Similar to vprintf. Returns the number of characters written, or an integer less than zeroon error.\membersection{wxString::Remove}\label{wxstringremove}\func{wxString\&}{Remove}{\param{size\_t}{ pos}}Same as Truncate. Removes the portion from {\it pos} to the end of the string.\func{wxString\&}{Remove}{\param{size\_t}{ pos}, \param{size\_t}{ len}}Removes {\it len} characters from the string, starting at {\it pos}.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::RemoveLast}\label{wxstringremovelast}\func{wxString\&}{RemoveLast}{\void}Removes the last character.\membersection{wxString::Replace}\label{wxstringreplace}\func{size\_t}{Replace}{\param{const wxChar*}{ szOld}, \param{const wxChar*}{ szNew}, \param{bool}{ replaceAll = true}}Replace first (or all) occurrences of substring with another one.{\it replaceAll}: global replace (default), or only the first occurrence.Returns the number of replacements made.\membersection{wxString::Right}\label{wxstringright}\constfunc{wxString}{Right}{\param{size\_t}{ count}}Returns the last {\it count} characters.\membersection{wxString::SetChar}\label{wxstringsetchar}\func{void}{SetChar}{\param{size\_t}{ n}, \param{wxChar}{ch}}Sets the character at position {\it n}.\membersection{wxString::Shrink}\label{wxstringshrink}\func{void}{Shrink}{\void}Minimizes the string's memory. This can be useful after a call to \helpref{Alloc()}{wxstringalloc} if too much memory were preallocated.\membersection{wxString::StartsWith}\label{wxstringstartswith}\constfunc{bool}{StartsWith}{\param{const wxChar }{*prefix}, \param{wxString }{*rest = NULL}}This function can be used to test if the string starts with the specified {\it prefix}. If it does, the function will return \true and put the restof the string (i.e. after the prefix) into {\it rest} string if it is not {\tt NULL}. Otherwise, the function returns \false and doesn't modify the{\it rest}.\membersection{wxString::EndsWith}\label{wxstringendswith}\constfunc{bool}{EndsWith}{\param{const wxChar }{*suffix}, \param{wxString }{*rest = NULL}}This function can be used to test if the string ends with the specified {\it suffix}. If it does, the function will return \true and put thebeginning of the string before the suffix into {\it rest} string if it is not {\tt NULL}. Otherwise, the function returns \false and doesn'tmodify the {\it rest}.\membersection{wxString::Strip}\label{wxstringstrip}\begin{verbatim}enum wxString::stripType {leading = 0x1, trailing = 0x2, both = 0x3};\end{verbatim}\constfunc{wxString}{Strip}{\param{stripType}{ s = trailing}}Strip characters at the front and/or end. The same as Trim except that itdoesn't change this string.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::SubString}\label{wxstringsubstring}\constfunc{wxString}{SubString}{\param{size\_t}{ from}, \param{size\_t}{ to}}Returns the part of the string between the indices {\it from} and {\it to}inclusive.This is a wxWidgets 1.xx compatibility function, use \helpref{Mid}{wxstringmid}instead (but note that parameters have different meaning).\membersection{wxString::ToAscii}\label{wxstringtoascii}\constfunc{const char*}{ToAscii}{\void}Converts the string to an ASCII, 7-bit string (ANSI builds only).\constfunc{const wxCharBuffer}{ToAscii}{\void}Converts the string to an ASCII, 7-bit string in the form ofa wxCharBuffer (Unicode builds only).Note that this conversion only works if the string contains only ASCIIcharacters. The \helpref{mb\_str}{wxstringmbstr} method provides morepowerful means of converting wxString to C string.\membersection{wxString::ToDouble}\label{wxstringtodouble}\constfunc{bool}{ToDouble}{\param{double}{ *val}}Attempts to convert the string to a floating point number. Returns \true onsuccess (the number is stored in the location pointed to by {\it val}) or \falseif the string does not represent such number.\wxheading{See also}\helpref{wxString::ToLong}{wxstringtolong},\\\helpref{wxString::ToULong}{wxstringtoulong}\membersection{wxString::ToLong}\label{wxstringtolong}\constfunc{bool}{ToLong}{\param{long}{ *val}, \param{int }{base = $10$}}Attempts to convert the string to a signed integer in base {\it base}. Returns\true on success in which case the number is stored in the locationpointed to by {\it val} or \false if the string does not represent avalid number in the given base.The value of {\it base} must be comprised between $2$ and $36$, inclusive, orbe a special value $0$ which means that the usual rules of {\tt C} numbers areapplied: if the number starts with {\tt 0x} it is considered to be in base$16$, if it starts with {\tt 0} - in base $8$ and in base $10$ otherwise. Notethat you may not want to specify the base $0$ if you are parsing the numberswhich may have leading zeroes as they can yield unexpected (to the user notfamiliar with C) results.\wxheading{See also}\helpref{wxString::ToDouble}{wxstringtodouble},\\\helpref{wxString::ToULong}{wxstringtoulong}\membersection{wxString::ToLongLong}\label{wxstringtolonglong}\constfunc{bool}{ToLongLong}{\param{wxLongLong\_t}{ *val}, \param{int }{base = $10$}}This is exactly the same as \helpref{ToLong}{wxstringtolong} but works with 64bit integer numbers.Notice that currently it doesn't work (always returns \false) if parsing of 64
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -