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

📄 stringutils.hpp

📁 一个gps小工具包
💻 HPP
📖 第 1 页 / 共 5 页
字号:
         /**          * Remove a string from the end of another string.          * Occurrences of the string \a aString appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& stripTrailing(std::string& s,                                   const std::string& aString,                                   std::string::size_type num = std::string::npos)         throw(StringException);         /**          * Remove a string from the end of another string const version.          * Occurrences of the string \a aString appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string stripTrailing(const std::string& s,                                   const std::string& aString,                                   std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s); stripTrailing(t, aString, num); return t;}         /**          * Remove a string from the end of another string.          * Occurrences of the string \a pString appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param pString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& stripTrailing(std::string& s,                const char* pString,                                    std::string::size_type num = std::string::npos)         throw(StringException)      { return stripTrailing(s, std::string(pString), num); }         /**          * Remove a string from the end of another string const version.          * Occurrences of the string \a pString appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param pString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string stripTrailing(const std::string& s,                const char* pString,                                    std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s); stripTrailing(t, std::string(pString), num); return t; }         /**          * Strip character(s) from the end of a string.          * Occurrences of the character \a aCharacter appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aCharacter character to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& stripTrailing(std::string& s,                                    const char aCharacter,                                   std::string::size_type num = std::string::npos)         throw(StringException)      { return stripTrailing(s, std::string(1,aCharacter), num); }         /**          * Strip character(s) from the end of a string const version.          * Occurrences of the character \a aCharacter appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aCharacter character to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string stripTrailing(const std::string& s,                                    const char aCharacter,                                   std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s); stripTrailing(t, std::string(1,aCharacter), num); return t; }         /**          * Strip blanks from the end of a string.          * Occurrences of the space character appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& stripTrailing(std::string& s,                                    std::string::size_type num = std::string::npos)         throw(StringException)      { return stripTrailing(s, std::string(1,' '), num); }         /**          * Strip blanks from the end of a string const version.          * Occurrences of the space character appearing          * at the end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string stripTrailing(const std::string& s,                                    std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s); stripTrailing(t, std::string(1,' '), num); return t;}         /**          * Remove a string from the beginning and end of another string.          * Occurrences of the string \a aString appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& strip(std::string& s,             const std::string& aString,                            std::string::size_type num = std::string::npos)         throw(StringException);         /**          * Remove a string from the beginning and end of another string const version.          * Occurrences of the string \a aString appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string strip(const std::string& s,             const std::string& aString,                            std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s);  strip(t, aString, num); return t; }         /**          * Remove a string from the beginning and end of another string.          * Occurrences of the string \a pString appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param pString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& strip(std::string& s,             const char* pString,                           std::string::size_type num = std::string::npos)         throw(StringException)      { return strip(s, std::string(pString), num); }         /**          * Remove a string from the beginning and end of another string cosnt version.          * Occurrences of the string \a pString appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param pString string to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string strip(const std::string& s,             const char* pString,                           std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s); strip(t, std::string(pString), num); return t; }         /**          * Strip character(s) from the beginning and end of a string.          * Occurrences of the character \a aCharacter appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aCharacter character to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& strip(std::string& s,             const char aCharacter,                           std::string::size_type num = std::string::npos)         throw(StringException)      { return strip(s, std::string(1,aCharacter), num); }         /**          * Strip character(s) from the beginning and end of a string const version.          * Occurrences of the character \a aCharacter appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param aCharacter character to remove.          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string strip(const std::string& s,             const char aCharacter,                           std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s);  strip(t, std::string(1,aCharacter), num); return t;}         /**          * Strip blanks from the beginning and end of a string.          * Occurrences of the space character appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string& strip(std::string& s,                            std::string::size_type num = std::string::npos)         throw(StringException)      { return strip(s, std::string(1, ' '), num); }         /**          * Strip blanks from the beginning and end of a string const version.          * Occurrences of the space character appearing          * at the beginning and end of the string \a s are removed.          * @param s string to be stripped (modified).          * @param num maximum number of occurrences to remove.          * @throws StringException if there's a std::exception thrown.          * @return a reference to \a s.          */      inline std::string strip(const std::string& s,                            std::string::size_type num = std::string::npos)         throw(StringException)      { std::string t(s);  strip(t, std::string(1, ' '), num); return t;}         /**          * Converts all of the receiver's characters that are in the          * first specified string to the corresponding character in          * the second specified string.          * @param aString string to perform translation on.          * @param inputChars characters in \a aString to translate from.          * @param outputChars characters to translate to.          * @param pad pad character in the event inputChars and          * outputChars are not equal length.  The pad character will          * become the translated character.          */      inline std::string translate(const std::string& aString,                              const std::string& inputChars,                              const std::string& outputChars,                              const char pad = ' ');         /**          * Changes occurrences of a specified pattern to a specified          * replacement string.  You can specify the number of changes          * to perform.  The default is to change all occurrences of          * the pattern. You can also specify the position in the          * receiver at which to begin.          * @param aString string to perform translation on.          * @param inputString The pattern string as a reference to an          *   object of type string.  The library searches for the          *   pattern string within the receiver's data.          * @param outputString The replacement string as a reference          *   to an object of type string. It replaces the occurrences          *   of the pattern string in the receiver's data.          * @param startPos The position to start the search at within          *   the receiver's data.  The default is 0.          * @param numChanges the number of patterns to search for and          *   change.  The default is to change all occurrences of the          *   pattern.          */      inline std::string change(const std::string& aString,                                const std::string& inputString,                                const std::string& outputString,                                std::string::size_type startPos = 0,                                unsigned numChanges = std::numeric_limits<unsigned>::max());         /**          * Changes occurrences of a specified pattern to a specified

⌨️ 快捷键说明

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