📄 pstring.h
字号:
) const; /**Compare two strings using the #PObject::Compare()# function. This is identical to the #PObject# class function but is necessary due to other overloaded versions. @return TRUE if not equal. */ BOOL operator!=( const PObject & str /// PString object to compare against. ) const; /**Compare two strings using the #PObject::Compare()# function. This is identical to the #PObject# class function but is necessary due to other overloaded versions. @return TRUE if less than. */ BOOL operator<( const PObject & str /// PString object to compare against. ) const; /**Compare two strings using the #PObject::Compare()# function. This is identical to the #PObject# class function but is necessary due to other overloaded versions. @return TRUE if greater than. */ BOOL operator>( const PObject & str /// PString object to compare against. ) const; /**Compare two strings using the #PObject::Compare()# function. This is identical to the #PObject# class function but is necessary due to other overloaded versions. @return TRUE if less than or equal. */ BOOL operator<=( const PObject & str /// PString object to compare against. ) const; /**Compare two strings using the #PObject::Compare()# function. This is identical to the #PObject# class function but is necessary due to other overloaded versions. @return TRUE if greater than or equal. */ BOOL operator>=( const PObject & str /// PString object to compare against. ) const; /**Compare a PString to a C string using a case insensitive compare function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr == "fred")\end{verbatim} @return TRUE if equal. */ BOOL operator*=( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the ##Compare()## function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr == "fred")\end{verbatim} @return TRUE if equal. */ BOOL operator==( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the #PObject::Compare()# function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr != "fred")\end{verbatim} @return TRUE if not equal. */ BOOL operator!=( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the #PObject::Compare()# function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr < "fred")\end{verbatim} @return TRUE if less than. */ BOOL operator<( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the #PObject::Compare()# function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr > "fred")\end{verbatim} @return TRUE if greater than. */ BOOL operator>( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the #PObject::Compare()# function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr <= "fred")\end{verbatim} @return TRUE if less than or equal. */ BOOL operator<=( const char * cstr /// C string to compare against. ) const; /**Compare a PString to a C string using the #PObject::Compare()# function. The #cstr# parameter is typically a literal string, eg:\begin{verbatim} if (myStr >= "fred")\end{verbatim} @return TRUE if greater than or equal. */ BOOL operator>=( const char * cstr /// C string to compare against. ) const; //@} /**@name Search & replace functions */ //@{ /** Locate the position within the string of the character. */ PINDEX Find( char ch, /// Character to search for in string. PINDEX offset = 0 /// Offset into string to begin search. ) const; /** Locate the position within the string of the substring. */ PINDEX Find( const PString & str, /// String to search for in string. PINDEX offset = 0 /// Offset into string to begin search. ) const; /* Locate the position within the string of the character or substring. The search will begin at the character offset provided. If #offset# is beyond the length of the string, then the function will always return #P_MAX_INDEX#. The matching will be for identical character or string. If a search ignoring case is required then the string should be converted to a #PCaselessString# before the search is made. @return position of character or substring in the string, or P_MAX_INDEX if the character or substring is not in the string. */ PINDEX Find( const char * cstr, /// C string to search for in string. PINDEX offset = 0 /// Offset into string to begin search. ) const; /** Locate the position of the last matching character. */ PINDEX FindLast( char ch, /// Character to search for in string. PINDEX offset = P_MAX_INDEX /// Offset into string to begin search. ) const; /** Locate the position of the last matching substring. */ PINDEX FindLast( const PString & str, /// String to search for in string. PINDEX offset = P_MAX_INDEX /// Offset into string to begin search. ) const; /**Locate the position of the last matching substring. Locate the position within the string of the last matching character or substring. The search will begin at the character offset provided, moving backward through the string. If #offset# is beyond the length of the string, then the search begins at the end of the string. If #offset# is zero then the function always returns #P_MAX_INDEX#. The matching will be for identical character or string. If a search ignoring case is required then the string should be converted to a #PCaselessString# before the search is made. @return position of character or substring in the string, or P_MAX_INDEX if the character or substring is not in the string. */ PINDEX FindLast( const char * cstr, /// C string to search for in string. PINDEX offset = P_MAX_INDEX /// Offset into string to begin search. ) const; /** Locate the position of one of the characters in the set. */ PINDEX FindOneOf( const PString & set, /// String of characters to search for in string. PINDEX offset = 0 /// Offset into string to begin search. ) const; /**Locate the position of one of the characters in the set. The search will begin at the character offset provided. If #offset# is beyond the length of the string, then the function will always return #P_MAX_INDEX#. The matching will be for identical character or string. If a search ignoring case is required then the string should be converted to a #PCaselessString# before the search is made. @return position of character in the string, or P_MAX_INDEX if no characters from the set are in the string. */ PINDEX FindOneOf( const char * cset, /// C string of characters to search for in string. PINDEX offset = 0 /// Offset into string to begin search. ) const; /**Locate the position within the string of one of the regular expression. The search will begin at the character offset provided. If #offset# is beyond the length of the string, then the function will always return #P_MAX_INDEX#. @return position of regular expression in the string, or P_MAX_INDEX if no characters from the set are in the string. */ PINDEX FindRegEx( const PRegularExpression & regex, /// regular expression to find PINDEX offset = 0 /// Offset into string to begin search. ) const; /**Locate the position within the string of one of the regular expression. The search will begin at the character offset provided. If #offset# is beyond the length of the string, then the function will always return #P_MAX_INDEX#. @return position of regular expression in the string, or P_MAX_INDEX if no characters from the set are in the string. */ BOOL FindRegEx( const PRegularExpression & regex, /// regular expression to find PINDEX & pos, /// Position of matched expression PINDEX & len, /// Length of matched expression PINDEX offset = 0, /// Offset into string to begin search. PINDEX maxPos = P_MAX_INDEX /// Maximum offset into string ) const; /**Locate the substring within the string and replace it with the specifed substring. The search will begin at the character offset provided. If #offset# is beyond the length of the string, then the function will do nothing. The matching will be for identical character or string. If a search ignoring case is required then the string should be converted to a #PCaselessString# before the search is made. */ void Replace( const PString & target, /// String to be replaced in string. const PString & subs, /// String to do replace in string. BOOL all = FALSE, /// Replace all occurrences of string. PINDEX offset = 0 /// Offset into string to begin search. ); /**Splice the string into the current string at the specified position. The specified number of bytes are removed from the string. Note that this function will break the current instance from multiple references to the string. A new string buffer is allocated and the data from the old string buffer copied to it. */ void Splice( const PString & str, /// Substring to insert. PINDEX pos, /// Position in string to insert the substring. PINDEX len = 0 /// Length of section to remove. ); /**Splice the string into the current string at the specified position. The specified number of bytes are removed from the string. Note that this function will break the current instance from multiple references to the string. A new string buffer is allocated and the data from the old string buffer copied to it. */ void Splice( const char * cstr, /// Substring to insert. PINDEX pos, /// Position in string to insert the substring. PINDEX len = 0 /// Length of section to remove. ); /**Remove the substring from the string. Note that this function will break the current instance from multiple references to the string. A new string buffer is allocated and the data from the old string buffer copied to it. */ void Delete( PINDEX start, /// Position in string to remove. PINDEX len /// Number of characters to delete. ); //@} /**@name Sub-string functions */ //@{ /**Extract a portion of the string into a new string. The original string is not changed and a new unique reference to a string is returned. The substring is returned inclusive of the characters at the #start# and #end# positions. If the #end# position is greater than the length of the string then all characters from the #start# up to the end of the string are returned. If #start# is greater than the length of the string or #end# is before #start# then an empty string is returned. @return substring of the source string. */ PString operator()( PINDEX start, /// Starting position of the substring. PINDEX end /// Ending position of the substring. ) const; /**Extract a portion of the string into a new string. The original string is not changed and a new unique reference to a string is returned. A substring from the beginning of the string for the number of characters specified is extracted. If #len# is greater than the length of the string then all characters to the end of the string are returned. If #len# is zero then an empty string is returned. @return substring of the source string. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -