Teuchos::StrUtils Class Reference

Provides string manipulation utilities that are not provided in the standard C++ string class. More...

#include <Teuchos_StrUtils.hpp>

List of all members.

Static Public Member Functions

Array< string > readFile (istream &is, char comment)
 Read a file, putting each line into a string.
Array< string > splitIntoLines (const string &input)
 Split an input string that contains newlines into an array of strings, one for each line.
Array< Array< string > > tokenizeFile (istream &is, char comment)
 Tokenize a file into whitespace-delimited tokens.
bool readLine (istream &is, string &line)
 Read a single line into a string.
Array< string > stringTokenizer (const string &str)
Array< string > getTokensPlusWhitespace (const string &str)
string reassembleFromTokens (const Array< string > &tokens, int iStart=0)
void splitList (const string &bigstring, Array< string > &elements)
int findNextWhitespace (const string &str, int offset)
int findNextNonWhitespace (const string &str, int offset)
string varSubstitute (const string &rawLine, const string &varName, const string &varValue)
string varTableSubstitute (const string &rawLine, const Array< string > &varNames, const Array< string > &varValues)
string envSubstitute (const string &line)
string before (const string &str, const string &sub)
 Find the substring before a specified substring. For example, before("abcdefghij", "gh") returns "abcdef".
string before (const string &str, char sub)
 Find the substring before a specified character. For example, before("abcdefghij", 'g') returns "abcdef".
string after (const string &str, const string &sub)
 Find the substring after a specified substring. For example, before("abcdefghij", "gh") returns "ij".
int find (const string &str, const string &sub)
 Find the position at which a substring first occurs. For example, find("abcdefghij", "gh") returns 6.
bool isWhite (const string &str)
 Returns true if a string consists entirely of whitespace.
string fixUnprintableCharacters (const string &str)
 Convert unprintable non-null characters to whitespace.
bool isNonWhite (const string &str)
 Returns true if a string has any non-whitespace.
string between (const string &str, const string &begin, const string &end, string &front, string &back)
 Returns the string between two delimiting strings, and returns by reference the strings before and after the delimiters.
string subString (const string &str, int begin, int end)
 Returns the substring between two positions.
string readFromStream (istream &is)
string allCaps (const string &str)
 Converts a string to all upper case.
double atof (const string &str)
 Returns the double value of a string.
int atoi (const string &str)
 Returns the int value of a string.


Detailed Description

Provides string manipulation utilities that are not provided in the standard C++ string class.

Definition at line 47 of file Teuchos_StrUtils.hpp.


Member Function Documentation

Array< string > StrUtils::readFile istream &  is,
char  comment
[static]
 

Read a file, putting each line into a string.

Definition at line 36 of file Teuchos_StrUtils.cpp.

Array< string > StrUtils::splitIntoLines const string &  input  )  [static]
 

Split an input string that contains newlines into an array of strings, one for each line.

Definition at line 50 of file Teuchos_StrUtils.cpp.

Array< Array< string > > StrUtils::tokenizeFile istream &  is,
char  comment
[static]
 

Tokenize a file into whitespace-delimited tokens.

Definition at line 67 of file Teuchos_StrUtils.cpp.

bool StrUtils::readLine istream &  is,
string &  line
[static]
 

Read a single line into a string.

Definition at line 87 of file Teuchos_StrUtils.cpp.

Array< string > StrUtils::stringTokenizer const string &  str  )  [static]
 

Definition at line 126 of file Teuchos_StrUtils.cpp.

Array< string > StrUtils::getTokensPlusWhitespace const string &  str  )  [static]
 

Definition at line 103 of file Teuchos_StrUtils.cpp.

string StrUtils::reassembleFromTokens const Array< string > &  tokens,
int  iStart = 0
[static]
 

Definition at line 142 of file Teuchos_StrUtils.cpp.

void StrUtils::splitList const string &  bigstring,
Array< string > &  elements
[static]
 

Definition at line 154 of file Teuchos_StrUtils.cpp.

int StrUtils::findNextWhitespace const string &  str,
int  offset
[static]
 

Definition at line 197 of file Teuchos_StrUtils.cpp.

int StrUtils::findNextNonWhitespace const string &  str,
int  offset
[static]
 

Definition at line 209 of file Teuchos_StrUtils.cpp.

string StrUtils::varSubstitute const string &  rawLine,
const string &  varName,
const string &  varValue
[static]
 

Definition at line 241 of file Teuchos_StrUtils.cpp.

string StrUtils::varTableSubstitute const string &  rawLine,
const Array< string > &  varNames,
const Array< string > &  varValues
[static]
 

Definition at line 222 of file Teuchos_StrUtils.cpp.

string Teuchos::StrUtils::envSubstitute const string &  line  )  [static]
 

string StrUtils::before const string &  str,
const string &  sub
[static]
 

Find the substring before a specified substring. For example, before("abcdefghij", "gh") returns "abcdef".

Definition at line 266 of file Teuchos_StrUtils.cpp.

string StrUtils::before const string &  str,
char  sub
[static]
 

Find the substring before a specified character. For example, before("abcdefghij", 'g') returns "abcdef".

Definition at line 258 of file Teuchos_StrUtils.cpp.

string StrUtils::after const string &  str,
const string &  sub
[static]
 

Find the substring after a specified substring. For example, before("abcdefghij", "gh") returns "ij".

Definition at line 278 of file Teuchos_StrUtils.cpp.

int StrUtils::find const string &  str,
const string &  sub
[static]
 

Find the position at which a substring first occurs. For example, find("abcdefghij", "gh") returns 6.

Definition at line 292 of file Teuchos_StrUtils.cpp.

bool StrUtils::isWhite const string &  str  )  [static]
 

Returns true if a string consists entirely of whitespace.

Definition at line 299 of file Teuchos_StrUtils.cpp.

string StrUtils::fixUnprintableCharacters const string &  str  )  [static]
 

Convert unprintable non-null characters to whitespace.

Definition at line 312 of file Teuchos_StrUtils.cpp.

bool Teuchos::StrUtils::isNonWhite const string &  str  )  [inline, static]
 

Returns true if a string has any non-whitespace.

Definition at line 109 of file Teuchos_StrUtils.hpp.

string StrUtils::between const string &  str,
const string &  begin,
const string &  end,
string &  front,
string &  back
[static]
 

Returns the 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 329 of file Teuchos_StrUtils.cpp.

string StrUtils::subString const string &  str,
int  begin,
int  end
[static]
 

Returns the substring between two positions.

For example, subString("abcdefghij", 2, 5) returns "cde".

Definition at line 340 of file Teuchos_StrUtils.cpp.

string StrUtils::readFromStream istream &  is  )  [static]
 

Definition at line 345 of file Teuchos_StrUtils.cpp.

string StrUtils::allCaps const string &  str  )  [static]
 

Converts a string to all upper case.

Definition at line 353 of file Teuchos_StrUtils.cpp.

double StrUtils::atof const string &  str  )  [static]
 

Returns the double value of a string.

Definition at line 363 of file Teuchos_StrUtils.cpp.

int StrUtils::atoi const string &  str  )  [static]
 

Returns the int value of a string.

Definition at line 368 of file Teuchos_StrUtils.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:41:20 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1