Teuchos - Trilinos Tools Package Version of the Day
|
Provides std::string manipulation utilities that are not provided in the standard C++ std::string class. More...
#include <Teuchos_StrUtils.hpp>
Static Public Member Functions | |
static Array< std::string > | readFile (std::istream &is, char comment) |
Read a file, putting each line into a std::string. | |
static Array< std::string > | splitIntoLines (const std::string &input) |
Split an input std::string that contains newlines into an array of strings, one for each line. | |
static Array< std::string > | splitString (const std::string_view s, const char sep=',') |
Split an input std::string using a seperator char sep. | |
static Array< Array< std::string > > | tokenizeFile (std::istream &is, char comment) |
Tokenize a file into whitespace-delimited tokens. | |
static bool | readLine (std::istream &is, std::string &line) |
Read a single line into a std::string. | |
static Array< std::string > | stringTokenizer (const std::string &str) |
static Array< std::string > | getTokensPlusWhitespace (const std::string &str) |
static std::string | reassembleFromTokens (const Array< std::string > &tokens, int iStart=0) |
static void | splitList (const std::string &bigstring, Array< std::string > &elements) |
static int | findNextWhitespace (const std::string &str, int offset) |
static int | findNextNonWhitespace (const std::string &str, int offset) |
static std::string | varSubstitute (const std::string &rawLine, const std::string &varName, const std::string &varValue) |
static std::string | varTableSubstitute (const std::string &rawLine, const Array< std::string > &varNames, const Array< std::string > &varValues) |
static std::string | before (const std::string &str, const std::string &sub) |
Find the substring before a specified substring. For example, before("abcdefghij", "gh") returns "abcdef". | |
static std::string | before (const std::string &str, char sub) |
Find the substring before a specified character. For example, before("abcdefghij", 'g') returns "abcdef". | |
static std::string | after (const std::string &str, const std::string &sub) |
Find the substring after a specified substring. For example, before("abcdefghij", "gh") returns "ij". | |
static int | find (const std::string &str, const std::string &sub) |
Find the position at which a substring first occurs. For example, find("abcdefghij", "gh") returns 6. | |
static bool | isWhite (const std::string &str) |
Returns true if a std::string consists entirely of whitespace. | |
static std::string | fixUnprintableCharacters (const std::string &str) |
Convert unprintable non-null characters to whitespace. | |
static bool | isNonWhite (const std::string &str) |
Returns true if a std::string has any non-whitespace. | |
static std::string | between (const std::string &str, const std::string &begin, const std::string &end, std::string &front, std::string &back) |
Returns the std::string between two delimiting strings, and returns by reference the strings before and after the delimiters. | |
static std::string | subString (const std::string &str, int begin, int end) |
Returns the substring between two positions. | |
static std::string | allCaps (const std::string &str) |
Converts a std::string to all upper case. | |
static double | atof (const std::string &str) |
Returns the double value of a std::string. | |
static int | atoi (const std::string &str) |
Returns the int value of a std::string. | |
static std::ostream & | printLines (std::ostream &os, const std::string &linePrefix, const std::string &lines) |
Print lines with prefix first. | |
static std::string | removeAllSpaces (std::string stringToClean) |
Removes all the spaces in a string. | |
Provides std::string manipulation utilities that are not provided in the standard C++ std::string class.
Definition at line 29 of file Teuchos_StrUtils.hpp.
Read a file, putting each line into a std::string.
Definition at line 17 of file Teuchos_StrUtils.cpp.
Split an input std::string that contains newlines into an array of strings, one for each line.
Definition at line 32 of file Teuchos_StrUtils.cpp.
|
static |
Split an input std::string using a seperator char sep.
Definition at line 51 of file Teuchos_StrUtils.cpp.
|
static |
Tokenize a file into whitespace-delimited tokens.
Definition at line 71 of file Teuchos_StrUtils.cpp.
|
static |
Read a single line into a std::string.
Definition at line 92 of file Teuchos_StrUtils.cpp.
Definition at line 131 of file Teuchos_StrUtils.cpp.
Definition at line 107 of file Teuchos_StrUtils.cpp.
|
static |
Definition at line 148 of file Teuchos_StrUtils.cpp.
|
static |
Definition at line 162 of file Teuchos_StrUtils.cpp.
Definition at line 205 of file Teuchos_StrUtils.cpp.
Definition at line 218 of file Teuchos_StrUtils.cpp.
|
static |
Definition at line 248 of file Teuchos_StrUtils.cpp.
|
static |
Definition at line 231 of file Teuchos_StrUtils.cpp.
Find the substring before a specified substring. For example, before("abcdefghij", "gh") returns "abcdef".
Definition at line 274 of file Teuchos_StrUtils.cpp.
Find the substring before a specified character. For example, before("abcdefghij", 'g') returns "abcdef".
Definition at line 265 of file Teuchos_StrUtils.cpp.
Find the substring after a specified substring. For example, before("abcdefghij", "gh") returns "ij".
Definition at line 287 of file Teuchos_StrUtils.cpp.
Find the position at which a substring first occurs. For example, find("abcdefghij", "gh") returns 6.
Definition at line 302 of file Teuchos_StrUtils.cpp.
Returns true if a std::string consists entirely of whitespace.
Definition at line 310 of file Teuchos_StrUtils.cpp.
|
static |
Convert unprintable non-null characters to whitespace.
Definition at line 324 of file Teuchos_StrUtils.cpp.
Returns true if a std::string has any non-whitespace.
Definition at line 99 of file Teuchos_StrUtils.hpp.
|
static |
Returns the std::string between two delimiting strings, and returns by reference the strings before and after the delimiters.
For example, between("abcdefghij", "c", "g", front, back) returns "def" and sets front to "ab", back to "hij".
Definition at line 342 of file Teuchos_StrUtils.cpp.
Returns the substring between two positions.
For example, subString("abcdefghij", 2, 5) returns "cde".
Definition at line 353 of file Teuchos_StrUtils.cpp.
|
static |
Converts a std::string to all upper case.
Definition at line 376 of file Teuchos_StrUtils.cpp.
Returns the double value of a std::string.
Definition at line 387 of file Teuchos_StrUtils.cpp.
Returns the int value of a std::string.
Definition at line 393 of file Teuchos_StrUtils.cpp.
|
static |
Print lines with prefix first.
Definition at line 399 of file Teuchos_StrUtils.cpp.
|
static |
Removes all the spaces in a string.
Definition at line 415 of file Teuchos_StrUtils.cpp.