⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wxstring.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 4 页
字号:
    //  size_t find_last_not_of(const char* s, size_t nStart = npos) const;    //  size_t find_last_not_of(char ch, size_t nStart = npos) const;    // All compare functions return a negative, zero or positive value    // if the [sub]string is less, equal or greater than the compare() argument.    // just like strcmp()  int compare(const wxString& str) const;    // comparison with a substring  int compare(size_t nStart, size_t nLen, const wxString& str) const;    // comparison of 2 substrings  int compare(size_t nStart, size_t nLen,              const wxString& str, size_t nStart2, size_t nLen2) const;    // just like strcmp()  int compare(const char* sz) const;    // substring comparison with first nCount characters of sz  int compare(size_t nStart, size_t nLen,              const char* sz, size_t nCount = npos) const;  // substring extraction  wxString substr(size_t nStart = 0, size_t nLen = npos) const;\end{verbatim}%%%%% MEMBERS HERE %%%%%\helponly{\insertatlevel{2}{\wxheading{Members}}}\membersection{wxString::wxString}\label{wxstringconstruct}\func{}{wxString}{\void}Default constructor. Initializes the string to {\tt ""} (empty string).\func{}{wxString}{\param{const wxString\&}{ x}}Copy constructor.\func{}{wxString}{\param{wxChar}{ ch}, \param{size\_t}{ n = 1}}Constructs a string of {\it n} copies of character {\it ch}.\func{}{wxString}{\param{const wxChar*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}Takes first {\it nLength} characters from the C string {\it psz}.The default value of {\tt wxSTRING\_MAXLEN} means to take all the string.Note that this constructor may be used even if {\it psz} points to a bufferwith binary data (i.e. containing {\tt NUL} characters) as long as you providethe correct value for {\it nLength}. However, the default form of it worksonly with strings without intermediate {\tt NUL}s because it uses {\tt strlen()} to calculate the effective length and it would not give correctresults otherwise.\func{}{wxString}{\param{const unsigned char*}{ psz}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}For compilers using unsigned char: takes first {\it nLength} characters from the C string {\it psz}.The default value of {\tt wxSTRING\_MAXLEN} means take all the string.For ANSI builds only (note the use of {\tt char} instead of {\tt wxChar}).\wxheading{Constructors with conversion}The following constructors allow you to construct wxString from a wide stringin ANSI build or from a C string in Unicode build.\func{}{wxString}{\param{const wchar\_t*}{ psz}, \param{wxMBConv\&}{ conv}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}Initializes the string from first \arg{nLength} characters of wide string. The default value of {\tt wxSTRING\_MAXLEN} means take all the string.In ANSI build, \arg{conv}'s \helpref{WC2MB}{wxmbconvwc2mb} method is called toconvert \arg{psz} to wide string. It is ignored in Unicode build.\func{}{wxString}{\param{const char*}{ psz}, \param{wxMBConv\&}{ conv}, \param{size\_t}{ nLength = wxSTRING\_MAXLEN}}Initializes the string from first \arg{nLength} characters of C string.The default value of {\tt wxSTRING\_MAXLEN} means take all the string.In Unicode build, \arg{conv}'s \helpref{MB2WC}{wxmbconvmb2wc} method is called toconvert \arg{psz} to wide string. It is ignored in ANSI build.\wxheading{See also}\helpref{wxMBConv classes}{mbconvclasses}, \helpref{mb\_str}{wxstringmbstr},\helpref{wc\_str}{wxstringwcstr}\membersection{wxString::\destruct{wxString}}\label{wxstringdestruct}\func{}{\destruct{wxString}}{\void}String destructor. Note that this is not virtual, so wxString must not be inherited from.\membersection{wxString::Alloc}\label{wxstringalloc}\func{void}{Alloc}{\param{size\_t}{ nLen}}Preallocate enough space for wxString to store {\it nLen} characters. This functionmay be used to increase speed when the string is constructed by repeatedconcatenation as in\begin{verbatim}// delete all vowels from the stringwxString DeleteAllVowels(const wxString& original){    wxString result;    size_t len = original.length();    result.Alloc(len);    for ( size_t n = 0; n < len; n++ )    {        if ( strchr("aeuio", tolower(original[n])) == NULL )            result += original[n];    }    return result;}\end{verbatim}because it will avoid the need to reallocate string memory many times (in caseof long strings). Note that it does not set the maximal length of a string - itwill still expand if more than {\it nLen} characters are stored in it. Also, itdoes not truncate the existing string (use \helpref{Truncate()}{wxstringtruncate} for this) even if its current length isgreater than {\it nLen}\membersection{wxString::Append}\label{wxstringappend}\func{wxString\&}{Append}{\param{const wxChar*}{ psz}}Concatenates {\it psz} to this string, returning a reference to it.\func{wxString\&}{Append}{\param{wxChar}{ ch}, \param{int}{ count = 1}}Concatenates character {\it ch} to this string, {\it count} times, returning a referenceto it.\membersection{wxString::AfterFirst}\label{wxstringafterfirst}\constfunc{wxString}{AfterFirst}{\param{wxChar}{ ch}}Gets all the characters after the first occurrence of {\it ch}.Returns the empty string if {\it ch} is not found.\membersection{wxString::AfterLast}\label{wxstringafterlast}\constfunc{wxString}{AfterLast}{\param{wxChar}{ ch}}Gets all the characters after the last occurrence of {\it ch}.Returns the whole string if {\it ch} is not found.\membersection{wxString::BeforeFirst}\label{wxstringbeforefirst}\constfunc{wxString}{BeforeFirst}{\param{wxChar}{ ch}}Gets all characters before the first occurrence of {\it ch}.Returns the whole string if {\it ch} is not found.\membersection{wxString::BeforeLast}\label{wxstringbeforelast}\constfunc{wxString}{BeforeLast}{\param{wxChar}{ ch}}Gets all characters before the last occurrence of {\it ch}.Returns the empty string if {\it ch} is not found.\membersection{wxString::c\_str}\label{wxstringcstr}\constfunc{const wxChar *}{c\_str}{\void}Returns a pointer to the string data ({\tt const char*} in ANSI build,{\tt const wchar\_t*} in Unicode build).\wxheading{See also}\helpref{mb\_str}{wxstringmbstr}, \helpref{wc\_str}{wxstringwcstr},\helpref{fn\_str}{wxstringfnstr}\membersection{wxString::Clear}\label{wxstringclear}\func{void}{Clear}{\void}Empties the string and frees memory occupied by it.See also: \helpref{Empty}{wxstringempty}\membersection{wxString::Cmp}\label{wxstringcmp}\constfunc{int}{Cmp}{\param{const wxString\&}{ s}}\constfunc{int}{Cmp}{\param{const wxChar*}{ psz}}Case-sensitive comparison.Returns a positive value if the string is greater than the argument, zero ifit is equal to it or a negative value if it is less than the argument (same semanticsas the standard {\it strcmp()} function).See also \helpref{CmpNoCase}{wxstringcmpnocase}, \helpref{IsSameAs}{wxstringissameas}.\membersection{wxString::CmpNoCase}\label{wxstringcmpnocase}\constfunc{int}{CmpNoCase}{\param{const wxString\&}{ s}}\constfunc{int}{CmpNoCase}{\param{const wxChar*}{ psz}}Case-insensitive comparison.Returns a positive value if the string is greater than the argument, zero ifit is equal to it or a negative value if it is less than the argument (same semanticsas the standard {\it strcmp()} function).See also \helpref{Cmp}{wxstringcmp}, \helpref{IsSameAs}{wxstringissameas}.\membersection{wxString::CompareTo}\label{wxstringcompareto}\begin{verbatim}enum wxString::caseCompare {exact, ignoreCase};\end{verbatim}\constfunc{int}{CompareTo}{\param{const wxChar*}{ psz}, \param{caseCompare}{ cmp = exact}}Case-sensitive comparison. Returns 0 if equal, 1 if greater or -1 if less.This is a wxWidgets 1.xx compatibility function; use \helpref{Cmp}{wxstringcmp} instead.\membersection{wxString::Contains}\label{wxstringcontains}\constfunc{bool}{Contains}{\param{const wxString\&}{ str}}Returns \true if target appears anywhere in wxString; else \false.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::Empty}\label{wxstringempty}\func{void}{Empty}{\void}Makes the string empty, but doesn't free memory occupied by the string.See also: \helpref{Clear()}{wxstringclear}.\membersection{wxString::Find}\label{wxstringfind}\constfunc{int}{Find}{\param{wxChar}{ ch}, \param{bool}{ fromEnd = false}}Searches for the given character. Returns the starting index, or {\tt wxNOT\_FOUND} if not found.\constfunc{int}{Find}{\param{const wxChar*}{ sz}}Searches for the given string. Returns the starting index, or {\tt wxNOT\_FOUND} if not found.\membersection{wxString::First}\label{wxstringfirst}\func{int}{First}{\param{wxChar}{ c}}\constfunc{int}{First}{\param{const wxChar*}{ psz}}\constfunc{int}{First}{\param{const wxString\&}{ str}}Same as \helpref{Find}{wxstringfind}.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::fn\_str}\label{wxstringfnstr}\constfunc{const wchar\_t*}{fn\_str}{\void}\constfunc{const char*}{fn\_str}{\void}\constfunc{const wxCharBuffer}{fn\_str}{\void}Returns string representation suitable for passing to OS' functions forfile handling. In ANSI build, this is same as \helpref{c\_str}{wxstringcstr}.In Unicode build, returned value can be either wide character stringor C string in charset matching the {\tt wxConvFileName} object, depending onthe OS.\wxheading{See also}\helpref{wxMBConv}{wxmbconv},\helpref{wc\_str}{wxstringwcstr}, \helpref{mb\_str}{wxstringwcstr}\membersection{wxString::Format}\label{wxstringformat}\func{static wxString}{Format}{\param{const wxChar }{*format}, \param{}{...}}This static function returns the string containing the result of calling \helpref{Printf}{wxstringprintf} with the passed parameters on it.\wxheading{See also}\helpref{FormatV}{wxstringformatv}, \helpref{Printf}{wxstringprintf}\membersection{wxString::FormatV}\label{wxstringformatv}\func{static wxString}{FormatV}{\param{const wxChar }{*format}, \param{va\_list }{argptr}}This static function returns the string containing the result of calling \helpref{PrintfV}{wxstringprintfv} with the passed parameters on it.\wxheading{See also}\helpref{Format}{wxstringformat}, \helpref{PrintfV}{wxstringprintfv}\membersection{wxString::Freq}\label{wxstringfreq}\constfunc{int}{Freq}{\param{wxChar }{ch}}Returns the number of occurrences of {\it ch} in the string.This is a wxWidgets 1.xx compatibility function; you should not use it in new code.\membersection{wxString::FromAscii}\label{wxstringfromascii}\func{static wxString }{FromAscii}{\param{const char*}{ s}}\func{static wxString }{FromAscii}{\param{const char}{ c}}Converts the string or character from an ASCII, 7-bit formto the native wxString representation. Most useful when usinga Unicode build of wxWidgets (note the use of {\tt char} instead of {\tt wxChar}).Use \helpref{wxString constructors}{wxstringconstruct} if youneed to convert from another charset.\membersection{wxString::GetChar}\label{wxstringgetchar}\constfunc{wxChar}{GetChar}{\param{size\_t}{ n}}Returns the character at position {\it n} (read-only).\membersection{wxString::GetData}\label{wxstringgetdata}\constfunc{const wxChar*}{GetData}{\void}wxWidgets compatibility conversion. Returns a constant pointer to the data in the string.\membersection{wxString::GetWritableChar}\label{wxstringgetwritablechar}\func{wxChar\&}{GetWritableChar}{\param{size\_t}{ n}}Returns a reference to the character at position {\it n}.\membersection{wxString::GetWriteBuf}\label{wxstringgetwritebuf}\func{wxChar*}{GetWriteBuf}{\param{size\_t}{ len}}Returns a writable buffer of at least {\it len} bytes.It returns a pointer to a new memory block, and theexisting data will not be copied.Call \helpref{wxString::UngetWriteBuf}{wxstringungetwritebuf} as soon as possibleto put the string back into a reasonable state.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -