Add a string(FIND) sub-command (#11795)

This commit is contained in:
Tim Hütz
2011-02-15 11:20:47 +01:00
committed by Brad King
parent 4d1240eb0a
commit 1462561a8c
4 changed files with 151 additions and 2 deletions
+6
View File
@@ -90,6 +90,7 @@ public:
" string(STRIP <string> <output variable>)\n"
" string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]\n"
" [RANDOM_SEED <seed>] <output variable>)\n"
" string(FIND <string> <substring> <output variable> [REVERSE])\n"
"REGEX MATCH will match the regular expression once and store the "
"match in the output variable.\n"
"REGEX MATCHALL will match the regular expression as many times as "
@@ -117,6 +118,10 @@ public:
"characters and default alphabet is all numbers and upper and "
"lower case letters. If an integer RANDOM_SEED is given, its "
"value will be used to seed the random number generator.\n"
"FIND will return the position where the given substring was found "
"in the supplied string. If the REVERSE flag was used, the command "
"will search for the position of the last occurrence of the "
"specified substring.\n"
"The following characters have special meaning in regular expressions:\n"
" ^ Matches at beginning of a line\n"
" $ Matches at end of a line\n"
@@ -152,6 +157,7 @@ protected:
bool HandleSubstringCommand(std::vector<std::string> const& args);
bool HandleStripCommand(std::vector<std::string> const& args);
bool HandleRandomCommand(std::vector<std::string> const& args);
bool HandleFindCommand(std::vector<std::string> const& args);
class RegexReplacement
{