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

📄 ncbistr.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    ///    occurrence of "pattern" in "str".    /// @param use_case    ///   Whether to do a case sensitive compare(default is eCase), or a    ///   case-insensitive compare (eNocase) while searching for the pattern.    /// @return    ///   - The start of the first or last (depending on "which" parameter)    ///   occurrence of "pattern" in "str", within the string interval    ///   ["start", "end"], or    ///   - NPOS if there is no occurrence of the pattern.    static SIZE_TYPE Find(const string& str, const string& pattern,                          SIZE_TYPE start = 0, SIZE_TYPE end = NPOS,                          EOccurrence which = eFirst,                          ECase use_case = eCase);    /// Find the pattern in the specfied range of a string using a case    /// sensitive search.    ///    /// @param str    ///   String to search.    /// @param pattern    ///   Pattern to search for in "str".     /// @param start    ///   Position in "str" to start search from -- default of 0 means start    ///   the search from the beginning of the string.    /// @param end    ///   Position in "str" to start search up to -- default of NPOS means    ///   to search to the end of the string.    /// @param which    ///   When set to eFirst, this means to find the first occurrence of     ///   "pattern" in "str". When set to eLast, this means to find the last    ///    occurrence of "pattern" in "str".    /// @return    ///   - The start of the first or last (depending on "which" parameter)    ///   occurrence of "pattern" in "str", within the string interval    ///   ["start", "end"], or    ///   - NPOS if there is no occurrence of the pattern.    static SIZE_TYPE FindCase  (const string& str, const string& pattern,                                SIZE_TYPE start = 0, SIZE_TYPE end = NPOS,                                EOccurrence which = eFirst);    /// Find the pattern in the specfied range of a string using a case    /// insensitive search.    ///    /// @param str    ///   String to search.    /// @param pattern    ///   Pattern to search for in "str".     /// @param start    ///   Position in "str" to start search from -- default of 0 means start    ///   the search from the beginning of the string.    /// @param end    ///   Position in "str" to start search up to -- default of NPOS means    ///   to search to the end of the string.    /// @param which    ///   When set to eFirst, this means to find the first occurrence of     ///   "pattern" in "str". When set to eLast, this means to find the last    ///    occurrence of "pattern" in "str".    /// @return    ///   - The start of the first or last (depending on "which" parameter)    ///   occurrence of "pattern" in "str", within the string interval    ///   ["start", "end"], or    ///   - NPOS if there is no occurrence of the pattern.    static SIZE_TYPE FindNoCase(const string& str, const string& pattern,                                SIZE_TYPE start = 0, SIZE_TYPE end = NPOS,                                EOccurrence which = eFirst);    /// Which end to truncate a string.    enum ETrunc {        eTrunc_Begin,  ///< Truncate leading spaces only        eTrunc_End,    ///< Truncate trailing spaces only        eTrunc_Both    ///< Truncate spaces at both begin and end of string    };    /// Truncate spaces in a string.    ///    /// @param str    ///   String to truncate spaces from.    /// @param where    ///   Which end of the string to truncate space from. Default is to    ///   truncate space from both ends (eTrunc_Both).    static string TruncateSpaces(const string& str, ETrunc where=eTrunc_Both);    /// Replace occurrences of a substring within a string.    ///    /// @param src    ///   Source string from which specified substring occurrences are    ///   replaced.    /// @param search    ///   Substring value in "src" that is replaced.    /// @param replace    ///   Replace "search" substring with this value.    /// @param dst    ///   Result of replacing the "search" string with "replace" in "src".    ///   This value is also returned by the function.    /// @param start_pos    ///   Position to start search from.    /// @param max_replace    ///   Replace no more than "max_replace" occurrences of substring "search"    ///   If "max_replace" is zero(default), then replace all occurrences with    ///   "replace".    /// @return    ///   Result of replacing the "search" string with "replace" in "src". This    ///   value is placed in "dst" as well.    /// @sa    ///   Version of Replace() that returns a new string.    static string& Replace(const string& src,                           const string& search,                           const string& replace,                           string& dst,                           SIZE_TYPE start_pos = 0, size_t max_replace = 0);    /// Replace occurrences of a substring within a string and returns the    /// result as a new string.    ///    /// @param src    ///   Source string from which specified substring occurrences are    ///   replaced.    /// @param search    ///   Substring value in "src" that is replaced.    /// @param replace    ///   Replace "search" substring with this value.    /// @param start_pos    ///   Position to start search from.    /// @param max_replace    ///   Replace no more than "max_replace" occurrences of substring "search"    ///   If "max_replace" is zero(default), then replace all occurrences with    ///   "replace".    /// @return    ///   A new string containing the result of replacing the "search" string    ///   with "replace" in "src"    /// @sa    ///   Version of Replace() that has a destination parameter to accept    ///   result.    static string Replace(const string& src,                          const string& search,                          const string& replace,                          SIZE_TYPE start_pos = 0, size_t max_replace = 0);    /// Whether to merge adjacent delimiters in Split and Tokenize.    enum EMergeDelims {        eNoMergeDelims,     ///< No merging of delimiters -- default for                            ///< Tokenize()        eMergeDelims        ///< Merge the delimiters -- default for Split()    };    /// Split a string using specified delimiters.    ///    /// @param str    ///   String to be split.    /// @param delim    ///   Delimiters used to split string "str".    /// @param arr    ///   The split tokens are added to the list "arr" and also returned    ///   by the function.     /// @param merge    ///   Whether to merge the delimiters or not. The default setting of    ///   eMergeDelims means that delimiters that immediately follow each other    ///   are treated as one delimiter.    /// @return     ///   The list "arr" is also returned.    /// @sa    ///   Tokenize()    static list<string>& Split(const string& str,                               const string& delim,                               list<string>& arr,                               EMergeDelims  merge = eMergeDelims);    /// Tokenize a string using the specified delimiters.    ///    ///    /// @param str    ///   String to be tokenized.    /// @param delim    ///   Delimiters used to tokenize string "str".    ///   If delimiter is empty, then input string is appended to "arr" as is.    /// @param arr    ///   The tokens defined in "str" by using symbols from "delim" are added    ///   to the list "arr" and also returned by the function.     /// @param merge    ///   Whether to merge the delimiters or not. The default setting of    ///   eNoMergeDelims means that delimiters that immediately follow each other    ///   are treated as separate delimiters.    /// @return     ///   The list "arr" is also returned.    /// @sa    ///   Split()    static vector<string>& Tokenize(const string&   str,                                    const string&   delim,                                    vector<string>& arr,                                    EMergeDelims    merge = eNoMergeDelims);    /// Split a string into two pieces using the specified delimiters    ///    ///    /// @param str     ///   String to be split.    /// @param delim    ///   Delimiters used to split string "str".    /// @param str1    ///   The sub-string of "str" before the first character of "delim".    ///   It will not contain any characters in "delim".    ///   Will be empty if "str" begin with a "delim" character.    /// @param str2    ///   The sub-string of "str" after the first character of "delim" found.    ///   May contain "delim" characters.    ///   Will be empty if "str" had no "delim" characters or ended    ///   with the first "delim" charcter.    /// @return    ///   true if a symbol from "delim" was found in "str", false if not.    ///   This lets you distinguish when there were no delimiters and when    ///   the very last character was the first delimiter.    /// @sa    ///   Split()    static bool SplitInTwo(const string& str,                            const string& delim,                           string& str1,                           string& str2);                             /// Join strings using the specified delimiter.    ///    /// @param arr    ///   Array of strings to be joined.    /// @param delim    ///   Delimiter used to join the string.    /// @return     ///   The strings in "arr" are joined into a single string, separated    ///   with "delim".    static string Join(const list<string>& arr,   const string& delim);    static string Join(const vector<string>& arr, const string& delim);    /// How to display new line characters.    ///    /// Assists in making a printable version of "str".    enum ENewLineMode {        eNewLine_Quote,         ///< Display "\n" instead of actual linebreak        eNewLine_Passthru       ///< Break the line on every "\n" occurrance    };    /// Get a printable version of the specified string.     ///    /// The non-printable characters will be represented as "\r", "\n", "\v",    /// "\t", "\"", "\\", or "\xDD" where DD is the character's code in    /// hexadecimal.    ///    /// @param str    ///   The string whose printable version is wanted.    /// @param nl_mode    ///   How to represent the new line character. The default setting of     ///   eNewLine_Quote displays the new line as "\n". If set to    ///   eNewLine_Passthru, a line break is used instead.    /// @return    ///   Return a printable version of "str".    /// @sa    ///   ParseEscapes    static string PrintableString(const string& str,                                  ENewLineMode  nl_mode = eNewLine_Quote);    /// Parse C-style escape sequences in the specified string, including    /// all those produced by PrintableString.    static string ParseEscapes(const string& str);    /// How to wrap the words in a string to a new line.    enum EWrapFlags {        fWrap_Hyphenate  = 0x1, ///< Add a hyphen when breaking words?        fWrap_HTMLPre    = 0x2  ///< Wrap as preformatted HTML?    };    typedef int TWrapFlags;     ///< Binary OR of "EWrapFlags"    /// Wrap the specified string into lines of a specified width -- prefix,    /// prefix1 default version.    ///    /// Split string "str" into lines of width "width" and add the    /// resulting lines to the list "arr". Normally, all    /// lines will begin with "prefix" (counted against "width"),    /// but the first line will instead begin with "prefix1" if    /// you supply it.    ///    /// @param str    ///   String to be split into wrapped lines.    /// @param width    ///   Width of each wrapped line.    /// @param arr    ///   List of strings containing wrapped lines.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0(default), do not add a prefix string to the    ///   wrapped lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0(default), do not add a prefix string to the    ///   first line.    /// @return    ///   Return "arr", the list of wrapped lines.    static list<string>& Wrap(const string& str, SIZE_TYPE width,                              list<string>& arr, TWrapFlags flags = 0,                              const string* prefix = 0,                              const string* prefix1 = 0);    /// Wrap the specified string into lines of a specified width -- prefix1    /// default version.    ///    /// Split string "str" into lines of width "width" and add the    /// resulting lines to the list "arr". Normally, all    /// lines will begin with "prefix" (counted against "width"),    /// but the first line will instead begin with "prefix1" if    /// you supply it.    ///    /// @param str    ///   String to be split into wrapped lines.    /// @param width    ///   Width of each wrapped line.    /// @param arr    ///   List of strings containing wrapped lines.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0, do not add a prefix string to the wrapped    ///   lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0(default), do not add a prefix string to the    ///   first line.    /// @return    ///   Return "arr", the list of wrapped lines.    static list<string>& Wrap(const string& str, SIZE_TYPE width,                              list<string>& arr, TWrapFlags flags,                              const string& prefix, const string* prefix1 = 0);    /// Wrap the specified string into lines of a specified width.    ///    /// Split string "str" into lines of width "width" and add the    /// resulting lines to the list "arr". Normally, all    /// lines will begin with "prefix" (counted against "width"),    /// but the first line will instead begin with "prefix1" if    /// you supply it.    ///    /// @param str    ///   String to be split into wrapped lines.    /// @param width    ///   Width of each wrapped line.    /// @param arr    ///   List of strings containing wrapped lines.    /// @param flags    ///   How to wrap the words to a new line. See EWrapFlags documentation.    /// @param prefix    ///   The prefix string added to each wrapped line, except the first line,    ///   unless "prefix1" is set.    ///   If "prefix" is set to 0, do not add a prefix string to the wrapped    ///   lines.    /// @param prefix1    ///   The prefix string for the first line. Use this for the first line    ///   instead of "prefix".    ///   If "prefix1" is set to 0, do not add a prefix string to the first    ///   line.    /// @return

⌨️ 快捷键说明

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