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

📄 xstring.hpp

📁 经典的string 函数库学习资料
💻 HPP
📖 第 1 页 / 共 2 页
字号:
        int compareIgnoreCase(const xstring& str) const;        /// @brief 把*this之内“从pos开始的最多n个字符”拿来和str进行比较,忽略大小写        int compareIgnoreCase(            size_type       pos,            size_type       n,            const xstring&  str        ) const;        /// @brief 把*this之内“从pos1开始的最多n1个字符”拿来和str之内“从pos2开始的最多n2个字符”进行比较,忽略大小写        int compareIgnoreCase(            size_type       pos1,            size_type       n1,            const xstring&  str,            size_type       pos2,            size_type       n2        ) const;        /// @brief 把*this拿来和C-string s的字符进行比较,忽略大小写        int compareIgnoreCase(const char* s) const;        /// @brief 把*this之内“从pos1开始的最多n个字符”拿来和C-string s的字符进行比较,忽略大小写        int compareIgnoreCase(            size_type   pos,            size_type   n1,            const char* s        ) const;        /// @brief 把*this之内“从pos1开始的最多n个字符”拿来和字符数组s内的n2字符进行比较,忽略大小写        int compareIgnoreCase(            size_type   pos,            size_type   n1,            const char* s,            size_type   n2        ) const;    // PHP手册上面的函数        /// @brief 给字符串增加转义        xstring addslashes(void) const;        /// @brief 去掉 addslashes()增加的转义字符        xstring stripslashes(void) const;        /// @brief 将字符串转换成16进制表示法        xstring bin2hex(void) const;        /// @brief 将字符串分成小块        xstring chunk_split(            unsigned int    chunklen    = 76,            const xstring&  end         = "\r\n"        ) const;        /// @brief 计算字符串的crc32多项式        unsigned int crc32(void) const;        /// @brief 计算字符串的md5散列        xstring md5(bool raw_output = false) const;        /// @brief 计算字符串的sha1散列        xstring sha1(bool raw_output = false) const;        /// @brief 单项散列函数,与FreeBSD 4.2版的crypt()函数的MD5算法兼容        xstring crypt(const xstring& salt = "") const;        /// @brief 根据字符串分割字符串        std::vector<xstring> explode(            const xstring&  separator,            unsigned int    limit   = 0        ) const;        /// @brief 转换HTML特殊字符        xstring htmlspecialchars(            QUOTE_STYLE quote_style = ENT_COMPAT        ) const;        /// @brief 在所有换行前面插入HTML换行        xstring nl2br(void) const;        /// @brief 去掉字符串开始的空白字符        xstring ltrim(void) const;        /// @brief 去掉字符串结尾的空白字符        xstring rtrim(void) const;        /// @brief 去掉字符串开始和结尾的空白字符        xstring trim(void) const;        /// @brief 转义元字符        xstring quotemeta(void) const;        /// @brief 用另一个字符串填补字符串到指定的长度        xstring str_pad(            size_type       pad_length,            const xstring&  pad_string  = " ",            PAD_TYPE  pad_type          = PAD_RIGHT        ) const;        /// @brief 重复字符串        xstring str_repeat(unsigned int multiplier) const;        /// @brief 把字符串中所有找到的search字符串替换为replace字符串        xstring& str_replace(            const xstring&  search,            const xstring&  replace,            size_type       count   = npos        );        /// @brief 忽略大小写版本的str_replace().        xstring& str_ireplace(            const xstring&  search,            const xstring&  replace,            size_type       count   = npos        );        /// @brief 对字符串进行ROT13转换        xstring str_rot13(void) const;        /// @brief 去除字符串中的HTML标签        xstring strip_tags(void) const;        /// @brief 反转一个字符串        xstring strrev(void) const;        /// @brief substr()函数的不抛出例外版本,并且可以接受负值作为参数        xstring safesubstr(            long long int start,            long long int length = npos        ) const;        /// @brief 对URL字符串进行编码        xstring urlencode(void) const;        /// @brief 解码URL编码的字符串        xstring urldecode(void) const;        /// @brief 根据RFC 1738对URL字符串进行编码        xstring rawurlencode(void) const;        /// @brief 解码URL编码的字符串        xstring rawurldecode(void) const;        /// @brief 用MIME base64编码方式编码        xstring base64_encode(void) const;        /// @brief 用MIME base64编码方式解码        xstring base64_decode(void) const;        /// @brief 正则表达式匹配        bool ereg(const xstring& regexp, std::vector<xstring>& regs) const;        /// @brief 正则表达式匹配        bool ereg(const xstring& regexp) const;        /// @brief 不区分大小写的正则表达式匹配        bool eregi(const xstring& regexp, std::vector<xstring>& regs) const;        /// @brief 不区分大小写的正则表达式匹配        bool eregi(const xstring& regexp) const;        /// @brief 替换正则表达式        xstring ereg_replace(            const xstring& regexp,            const xstring& replacement        ) const;        /// @brief 不区分大小写替换正则表达式        xstring eregi_replace(            const xstring& regexp,            const xstring& replacement        ) const;        /// @brief 用正则表达式将字符串分割到vector中        std::vector<xstring> split(            const xstring&  regexp,            unsigned int    limit        ) const;        /// @brief 用正则表达式不区分大小写将字符串分割到vector中        std::vector<xstring> spliti(            const xstring&  regexp,            unsigned int    limit        ) const;        /// @brief 返回路径中的文件名部分        xstring basename(const xstring& suffix = "") const;        /// @brief 返回路径中的目录部分        xstring dirname(void) const;        /// @brief 取第一个单词(原始字符串将被改变)        xstring getWord(const xstring& separator = " ");        /// @brief 是否全是由GB2312字符集中的汉字(包括ASCII字符)构成        bool isGB2312(void) const;//============================================================================    private:        /// @version unstable        template <typename UnaryOperation>        xstring toFoo(UnaryOperation op) const;        /// @version unstable        template <typename UnaryOperation>        bool isFoo(UnaryOperation op) const;        /// @version unstable        static xstring regerrmsg(int errcode, regex_t* compiled);        /// @version unstable        static void regcomp_throw(            regex_t* compiled,            const char* pattern,            int cflags        );        /// @version unstable        static int regexec_throw(            regex_t* compiled,            const char* string,            size_t nmatch,            regmatch_t matchptr[],            int eflags        );    };  // class xstring}   // namespace x#include "xstring_I.hpp"#endif  // ifndef XSTRING_HPP

⌨️ 快捷键说明

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