= SubString = [[TracNav(TracNav/TOC_Development)]] !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). == Create a !SubString == Creating a new !SubString with all possible options: {{{ SubString(const std::string& string, const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false, char escapeChar ='\\', bool removeEscapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true, char openparenthesis_char = '(', char closeparenthesis_char = ')', bool removeParenthesisChars = true, char comment_char = '\0'); }}} Although !SubString is very open for arbitrary control symbols, you will most often use one of the following configurations: * '''!SubString(string, ' ', SubString::WhiteSpaces)''': Splits a string into words. Words between "" or () will be one token, but "" and () will be removed.[[br]] * Example: * String: Hello, this is "a test" (but don't tell anyone) * Tokens: Hello, | this | is | a test | but don't tell anyone * '''!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. * Example: * String: Hello, this is "a test" (but don't tell anyone) * Tokens: Hello, | this | is | "a test" | (but don't tell anyone) * '''!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. * Example: * String: (10, 20, 30) * Tokens: 10 | 20 | 30 == Functions == * '''size()''': Returns the number of tokens. * '''getString('''''index''''')''' or '''operator['''''index''''']''': Returns the token at position ''index''. * '''subSet('''''begin''''', '''''end''''')''': Returns a new !SubString, containing tokens from begin to end-1. * '''join('''''char''''')''': Joins the tokens together to one string. Separates the tokens by ''char''.