Changes between Version 1 and Version 2 of code/doc/SubString
- Timestamp:
- Sep 24, 2008, 7:13:15 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
code/doc/SubString
v1 v2 2 2 [[TracNav(TracNav/TOC_Development)]] 3 3 4 SubString splits a string up into several tokens. You can define the separator and chars for opening and closing paranthesis (usually '(' and ')') and quotes (usually '"'). Tokens between paranthesis or quotes wont be separated. It also takes care of an escape symbol (mostly '\') to escape special symbols and a comment symbol (usually '\0' for no comment) to end the string. There are more options to strip those symbols or to keep them (added to a token).4 !SubString splits a string up into several tokens. You can define the separator and chars for opening and closing paranthesis (usually '(' and ')') and quotes (usually '"'). Tokens between paranthesis or quotes wont be separated. It also takes care of an escape symbol (mostly '\') to escape special symbols and a comment symbol (usually '\0' for no comment) to end the string. There are more options to strip those symbols or to keep them (added to a token). 5 5 6 6 == Create a SubString == 7 7 8 Creating a new SubString with all possible options:8 Creating a new !SubString with all possible options: 9 9 {{{ 10 10 SubString(const std::string& string, … … 22 22 }}} 23 23 24 Although SubString is very open for arbitrary control symbols, you will most often use one of the following configurations:25 * ''' SubString(string, ' ', SubString::WhiteSpaces)''': Splits a string into words. Words between "" or () will be one token, but "" and () will be removed.[[br]]24 Although !SubString is very open for arbitrary control symbols, you will most often use one of the following configurations: 25 * '''!SubString(string, ' ', SubString::WhiteSpaces)''': Splits a string into words. Words between "" or () will be one token, but "" and () will be removed.[[br]] 26 26 * Example: 27 27 * String: Hello, this is "a test" (but don't tell anyone) 28 28 * Tokens: Hello, | this | is | a test | but don't tell anyone 29 29 30 * ''' SubString(string, ' ', "", true, '\\', false, '"', false, '(', ')', false)''': Splits a string into words. Words between "" or () will be one token. Escape chars, "", () and whitespaces wont be removed.30 * '''!SubString(string, ' ', "", true, '\\', false, '"', false, '(', ')', false)''': Splits a string into words. Words between "" or () will be one token. Escape chars, "", () and whitespaces wont be removed. 31 31 * Example: 32 32 * String: Hello, this is "a test" (but don't tell anyone) 33 33 * Tokens: Hello, | this | is | "a test" | (but don't tell anyone) 34 34 35 * ''' SubString(string, ',' " \t\n()", true, '\', true, '"', true, '\0', '\0')''': Splits tokens separated by a comma. Tokens between "" wont be separated but ( and ) have no effect.35 * '''!SubString(string, ',' " \t\n()", true, '\', true, '"', true, '\0', '\0')''': Splits tokens separated by a comma. Tokens between "" wont be separated but ( and ) have no effect. 36 36 * Example: 37 37 * String: (10, 20, 30) … … 41 41 * '''size()''': Returns the number of tokens. 42 42 * '''getString('''''index''''')''' or '''operator['''''index''''']''': Returns the token at position ''index''. 43 * '''subSet('''''begin''''', '''''end''''')''': Returns a new SubString, containing tokens from begin to end-1.43 * '''subSet('''''begin''''', '''''end''''')''': Returns a new !SubString, containing tokens from begin to end-1. 44 44 * '''join('''''char''''')''': Joins the tokens together to one string. Separates the tokens by ''char''.