Text String Manipulation Tools


Classes

class  StringException
 This is thrown instread of a std::exception when a gpstk::StringUtils function fails. More...
class  HexDumpDataConfig
 Class for configuring the appearance of hexDumpData() output. More...

Functions

void gpstk::StringUtils::hexDumpData (std::ostream &s, const std::string &data, unsigned indent=0, HexDumpDataConfig cfg=HexDumpDataConfig())
 Perform a formatted hex-dump of the (potentially) binary data to the given stream.
void gpstk::StringUtils::hexDumpData (std::ostream &s, const std::string &data, const std::string &tag, HexDumpDataConfig cfg=HexDumpDataConfig())
 Perform a formatted hex-dump of the (potentially) binary data to the given stream.
std::string & gpstk::StringUtils::stripLeading (std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning of another string.
std::string gpstk::StringUtils::stripLeading (const std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning of another string const version.
std::string & gpstk::StringUtils::stripLeading (std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning of another string.
std::string gpstk::StringUtils::stripLeading (const std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning of another string const version.
std::string & gpstk::StringUtils::stripLeading (std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the beginning of a string.
std::string gpstk::StringUtils::stripLeading (const std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the beginning of a string const version.
std::string & gpstk::StringUtils::stripLeading (std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the beginning of a string.
std::string gpstk::StringUtils::stripLeading (const std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the beginning of a string const version.
std::string & gpstk::StringUtils::stripTrailing (std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the end of another string.
std::string gpstk::StringUtils::stripTrailing (const std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the end of another string const version.
std::string & gpstk::StringUtils::stripTrailing (std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the end of another string.
std::string gpstk::StringUtils::stripTrailing (const std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the end of another string const version.
std::string & gpstk::StringUtils::stripTrailing (std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the end of a string.
std::string gpstk::StringUtils::stripTrailing (const std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the end of a string const version.
std::string & gpstk::StringUtils::stripTrailing (std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the end of a string.
std::string gpstk::StringUtils::stripTrailing (const std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the end of a string const version.
std::string & gpstk::StringUtils::strip (std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning and end of another string.
std::string gpstk::StringUtils::strip (const std::string &s, const std::string &aString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning and end of another string const version.
std::string & gpstk::StringUtils::strip (std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning and end of another string.
std::string gpstk::StringUtils::strip (const std::string &s, const char *pString, std::string::size_type num=std::string::npos) throw (StringException)
 Remove a string from the beginning and end of another string cosnt version.
std::string & gpstk::StringUtils::strip (std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the beginning and end of a string.
std::string gpstk::StringUtils::strip (const std::string &s, const char aCharacter, std::string::size_type num=std::string::npos) throw (StringException)
 Strip character(s) from the beginning and end of a string const version.
std::string & gpstk::StringUtils::strip (std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the beginning and end of a string.
std::string gpstk::StringUtils::strip (const std::string &s, std::string::size_type num=std::string::npos) throw (StringException)
 Strip blanks from the beginning and end of a string const version.
std::string gpstk::StringUtils::translate (const std::string &aString, const std::string &inputChars, const std::string &outputChars, const char pad= ' ')
 Converts all of the receiver's characters that are in the first specified string to the corresponding character in the second specified string.
std::string gpstk::StringUtils::change (const std::string &aString, const std::string &inputString, const std::string &outputString, std::string::size_type startPos=0, unsigned numChanges=(std::numeric_limits< unsigned >::max)())
 Changes occurrences of a specified pattern to a specified replacement string.
std::string & gpstk::StringUtils::change (std::string &aString, const std::string &inputString, const std::string &outputString, std::string::size_type startPos=0, unsigned numChanges=(std::numeric_limits< unsigned >::max)())
 Changes occurrences of a specified pattern to a specified replacement string.
std::string & gpstk::StringUtils::rightJustify (std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Right-justifies the receiver in a string of the specified length.
std::string gpstk::StringUtils::rightJustify (const std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Right-justifies the receiver in a string of the specified length (const version).
std::string & gpstk::StringUtils::leftJustify (std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Left-justifies the receiver in a string of the specified length.
std::string gpstk::StringUtils::leftJustify (const std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Left-justifies the receiver in a string of the specified length (const version).
std::string & gpstk::StringUtils::center (std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Change the length of a string by adding to the beginning and end.
std::string gpstk::StringUtils::center (const std::string &s, const std::string::size_type length, const char pad= ' ') throw (StringException)
 Change the length of a string by adding to the beginning and end (const version).
double gpstk::StringUtils::asDouble (const std::string &s)
 Convert a string to a double precision floating point number.
long gpstk::StringUtils::asInt (const std::string &s)
 Convert a string to an integer.
unsigned long gpstk::StringUtils::asUnsigned (const std::string &s)
 Convert a string to an unsigned integer.
float gpstk::StringUtils::asFloat (const std::string &s) throw (StringException)
 Convert a string to a single precision floating point number.
long double gpstk::StringUtils::asLongDouble (const std::string &s) throw (StringException)
 Convert a string to a big precision floating point number.
template<class X>
gpstk::StringUtils::asData (const std::string &s) throw (StringException)
 Convert a value in a string to a type specified by the template class.
std::string gpstk::StringUtils::asString (const long double x, const std::string::size_type precision=21)
 Convert a long double to a string in fixed notation.
std::string gpstk::StringUtils::asString (const double x, const std::string::size_type precision=17)
 Convert a double to a string in fixed notation.
template<class X>
std::string gpstk::StringUtils::asString (const X x)
 Convert any old object to a string.
std::string & gpstk::StringUtils::d2x (std::string &s) throw (StringException)
 Convert a decimal string to a hexadecimal string.
std::string gpstk::StringUtils::d2x (const std::string &s) throw (StringException)
 Convert a decimal string to a hexadecimal string.
std::string & gpstk::StringUtils::x2d (std::string &s) throw (StringException)
std::string gpstk::StringUtils::x2d (const std::string &s) throw (StringException)
 Convert a hexadecimal string to a decimal string.
std::string & gpstk::StringUtils::c2x (std::string &s) throw (StringException)
 Convert a character string to a hexadecimal string.
std::string gpstk::StringUtils::c2x (const std::string &s) throw (StringException)
 Convert a character string to a hexadecimal string.
unsigned int gpstk::StringUtils::x2uint (const std::string &s) throw (StringException)
std::string gpstk::StringUtils::int2x (const unsigned int &i) throw (StringException)
 Convert an int to a string.
std::string & gpstk::StringUtils::replaceAll (std::string &s, const std::string &oldString, const std::string &newString) throw (StringException)
 Replace all instances of oldString with newString in s.
bool gpstk::StringUtils::isDigitString (const std::string &s)
 isDigitString is exactly like the C function isDigit except it checks all the characters of string s to see if they are all digits.
bool gpstk::StringUtils::isDecimalString (const std::string &s)
 isDecimalString is like isDigitString() except it allows a single period ('.') character in the string.
bool gpstk::StringUtils::isScientificString (const std::string &s)
 isScientificString extends isDecimalString() to allow a single exponent (E,e,D,d) character between a decimal string and a (possibly empty) digit string.
bool gpstk::StringUtils::isAlphaString (const std::string &s)
 isAlphaString is exactly like the C function isAlpha except it checks all the characters of string s to see if they are all alphabet characters.
std::string gpstk::StringUtils::matches (const std::string &s, const std::string &aPattern, const char zeroOrMore= '*', const char oneOrMore= '+', const char anyChar= '.') throw (StringException)
 Perform pattern matching on strings.
bool gpstk::StringUtils::isLike (const std::string &s, const std::string &aPattern, const char zeroOrMore= '*', const char oneOrMore= '+', const char anyChar= '.') throw (StringException)
 Perform pattern matching on strings.
bool gpstk::StringUtils::isLike (const std::string &s, const char *pPattern, const char zeroOrMore= '*', const char oneOrMore= '+', const char anyChar= '.') throw (StringException)
 Perform pattern matching on strings.
template<class T>
std::string gpstk::StringUtils::formattedPrint (const std::string &fmt, const std::string &pat, const std::string &rep, T to) throw (StringException)
 Work-horse method for printf.
std::string gpstk::StringUtils::subString (const std::string &s, const std::string::size_type startPos=0, const std::string::size_type length=std::string::npos, const char pad= ' ') throw (StringException)
 Get a substring of a string.
std::string & gpstk::StringUtils::lowerCase (std::string &s)
 Change all upper-case letters in a string to lower-case.
std::string gpstk::StringUtils::lowerCase (const std::string &s)
 Change all upper-case letters in a string to lower-case.
std::string & gpstk::StringUtils::upperCase (std::string &s)
 Change all lower-case letters in a string to upper-case.
std::string gpstk::StringUtils::upperCase (const std::string &s)
 Change all lower-case letters in a string to upper-case.
std::string gpstk::StringUtils::memToString (const void *p, const std::string::size_type size)
 Make a string from a void pointer.
std::string gpstk::StringUtils::firstWord (const std::string &s, const char delimiter= ' ') throw (StringException)
 Returns the first word in string s without modifying the string.
int gpstk::StringUtils::numWords (const std::string &s, const char delimiter= ' ') throw (StringException)
 Counts the number of words in s and returns it.
std::string gpstk::StringUtils::words (const std::string &s, const std::string::size_type firstWord=0, const std::string::size_type numWords=std::string::npos, const char delimiter= ' ') throw (StringException)
 Returns numWords words starting with firstWord from s (if any).
std::string gpstk::StringUtils::word (const std::string &s, const std::string::size_type wordNum=0, const char delimiter= ' ') throw (StringException)
 Returns word number wordNum from s (if any).
std::string gpstk::StringUtils::stripFirstWord (std::string &s, const char delimiter= ' ') throw (StringException)
 Removes the first word off string s and returns it.
std::vector< std::string > gpstk::StringUtils::split (const std::string &str, const char delimiter= ' ') throw (StringException)
 Split a string str into words as defined by delimiter.
std::string & gpstk::StringUtils::removeWords (std::string &s, const std::string::size_type first=0, const std::string::size_type wordsToReplace=std::string::npos, const char delimiter= ' ') throw (StringException)
 Removes indicated words from the string s.
std::string gpstk::StringUtils::doub2sci (const double &d, const std::string::size_type length, const std::string::size_type expLen, const bool showSign=true, const bool checkSwitch=true)
 Convert a double to a scientific notation number.
std::string gpstk::StringUtils::doubleToScientific (const double &d, const std::string::size_type length, const std::string::size_type precision, const std::string::size_type explen, bool showPlus=false)
 Convert a double to scientific notation; this routine works better, on Windows particularly, than doub2sci.
std::string & gpstk::StringUtils::sci2for (std::string &aStr, const std::string::size_type startPos=0, const std::string::size_type length=std::string::npos, const std::string::size_type expLen=3, const bool checkSwitch=true) throw (StringException)
 Convert scientific notation to FORTRAN notation.
std::string gpstk::StringUtils::doub2for (const double &d, const std::string::size_type length, const std::string::size_type expLen, const bool checkSwitch=true) throw (StringException)
 Convert double precision floating point to a string containing the number in FORTRAN notation.
double gpstk::StringUtils::for2doub (const std::string &aStr, const std::string::size_type startPos=0, const std::string::size_type length=std::string::npos)
 Convert FORTRAN representation of a double precision floating point in a string to a number.
std::string gpstk::StringUtils::printable (const std::string &aStr) throw (StringException)
 Change a string into printable characters.
std::string & gpstk::StringUtils::prettyPrint (std::string &aStr, const std::string &lineDelim="\n", const std::string &indent="", const std::string &firstIndent=" ", const std::string::size_type len=80, const char wordDelim= ' ') throw (StringException)
 Nicely expands the input string into several lines, non-const version.
std::string gpstk::StringUtils::prettyPrint (const std::string &aStr, const std::string &lineDelim="\n", const std::string &indent="", const std::string &firstIndent=" ", const std::string::size_type len=80, const char wordDelim= ' ') throw (StringException)
 Const version of prettyPrint, which nicely expands the input string into several lines.
std::vector< std::string > gpstk::StringUtils::split (const std::string &aStr, const std::string &theDelimiters=" ", bool trimWhitespace=false, bool ignoreEmpty=true)
 Split a string by some delimiters.


Function Documentation

X asData const std::string &  s  )  throw (StringException) [inline]
 

Convert a value in a string to a type specified by the template class.

The template class type must have stream operators defined.

Parameters:
x object to turn into the templatized type.
Returns:
the template object of x.

Definition at line 1744 of file StringUtils.hpp.

References GPSTK_THROW.

double asDouble const std::string &  s  )  [inline]
 

Convert a string to a double precision floating point number.

Parameters:
s string containing a number.
Returns:
double representation of string.

Definition at line 732 of file StringUtils.hpp.

Referenced by EOPStore::addIERSFile(), ConfDataReader::fetchListValueAsDouble(), ConfDataReader::getValueAsDouble(), ObsEphReaderFramework::initialize(), OceanLoading::initializeSites(), EOPPrediction::loadFile(), SatOrbitStore::loadGNV1BFile(), EOPDataStore::loadIERSFile(), EOPDataStore::loadSTKFile(), EarthOceanTide::loadTideFile(), main(), gpstk::mixedScanTime(), ConfDataItem::parse(), IonexHeader::ParseDcbRecord(), RinexObsHeader::ParseHeaderRecord(), Rinex3ObsHeader::ParseHeaderRecord(), Rinex3ClockHeader::ParseHeaderRecord(), IonexHeader::ParseHeaderRecord(), AntexHeader::ParseHeaderRecord(), YumaData::reallyGetRecord(), SP3Header::reallyGetRecord(), SP3Data::reallyGetRecord(), SMODFData::reallyGetRecord(), SEMData::reallyGetRecord(), RinexObsData::reallyGetRecord(), RinexNavHeader::reallyGetRecord(), RinexMetHeader::reallyGetRecord(), RinexClockHeader::reallyGetRecord(), RinexClockData::reallyGetRecord(), Rinex3ObsData::reallyGetRecord(), Rinex3NavHeader::reallyGetRecord(), MSCData::reallyGetRecord(), IonexData::reallyGetRecord(), gpstk::reallyGetRecordVer2(), gpstk::scanTime(), YDSTime::setFromInfo(), GPSWeekSecond::setFromInfo(), CivilTime::setFromInfo(), GDCconfiguration::setParameter(), and Position::setToString().

float asFloat const std::string &  s  )  throw (StringException) [inline]
 

Convert a string to a single precision floating point number.

Parameters:
s string containing a number.
Returns:
single representation of string.

Definition at line 1709 of file StringUtils.hpp.

References GPSTK_THROW.

Referenced by main().

long asInt const std::string &  s  )  [inline]
 

Convert a string to an integer.

Parameters:
s string containing a number.
Returns:
long integer representation of string.

Definition at line 740 of file StringUtils.hpp.

Referenced by SVExclusionList::addFile(), EOPStore::addIERSFile(), gpstk::StringUtils::asString(), AshtechEPB::decode(), CommandOptionParser::displayUsage(), ConfDataReader::fetchListValueAsInt(), gpstk::GetCarrierBand(), TimeTag::getInfo(), ConfDataReader::getValueAsInt(), FileSpec::init(), EOPPrediction::loadFile(), SatOrbitStore::loadGNV1BFile(), EOPDataStore::loadSTKFile(), EarthOceanTide::loadTideFile(), main(), gpstk::mixedScanTime(), Test::otherTest(), ConfDataItem::parse(), IonexHeader::ParseDcbRecord(), RinexObsHeader::ParseHeaderRecord(), Rinex3ObsHeader::ParseHeaderRecord(), Rinex3ClockHeader::ParseHeaderRecord(), IonexHeader::ParseHeaderRecord(), PackedNavBits::rawBitInput(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), SolarSystem::readASCIIheader(), PlanetEphemeris::readASCIIheader(), YumaData::reallyGetRecord(), SP3Header::reallyGetRecord(), SP3Data::reallyGetRecord(), SMODFData::reallyGetRecord(), SEMHeader::reallyGetRecord(), SEMData::reallyGetRecord(), RinexObsData::reallyGetRecord(), RinexNavHeader::reallyGetRecord(), RinexMetHeader::reallyGetRecord(), RinexClockHeader::reallyGetRecord(), RinexClockData::reallyGetRecord(), Rinex3ObsData::reallyGetRecord(), Rinex3NavHeader::reallyGetRecord(), MSCData::reallyGetRecord(), IonexData::reallyGetRecord(), FICData::reallyGetRecord(), gpstk::reallyGetRecordVer2(), gpstk::scanTime(), YDSTime::setFromInfo(), UnixTime::setFromInfo(), MJD::setFromInfo(), JulianDate::setFromInfo(), GPSWeekZcount::setFromInfo(), GPSWeekSecond::setFromInfo(), GPSWeek::setFromInfo(), CivilTime::setFromInfo(), ANSITime::setFromInfo(), and Position::setToString().

long double asLongDouble const std::string &  s  )  throw (StringException) [inline]
 

Convert a string to a big precision floating point number.

Parameters:
s string containing a number.
Returns:
long double representation of string.

Definition at line 1726 of file StringUtils.hpp.

References GPSTK_THROW.

Referenced by main(), gpstk::mixedScanTime(), MJD::setFromInfo(), and JulianDate::setFromInfo().

std::string asString const X  x  )  [inline]
 

Convert any old object to a string.

The class must have stream operators defined.

Parameters:
x object to turn into a string.
Returns:
string representation of x.

Definition at line 1776 of file StringUtils.hpp.

References gpstk::StringUtils::asInt(), and gpstk::StringUtils::stripLeading().

std::string asString const double  x,
const std::string::size_type  precision = 17
[inline]
 

Convert a double to a string in fixed notation.

Parameters:
x double.
precision the number of decimal places you want displayed.
Returns:
string representation of x.

Definition at line 1768 of file StringUtils.hpp.

std::string asString const long double  x,
const std::string::size_type  precision = 21
[inline]
 

Convert a long double to a string in fixed notation.

Parameters:
x long double.
precision the number of decimal places you want displayed.
Returns:
string representation of x.

Definition at line 1761 of file StringUtils.hpp.

unsigned long asUnsigned const std::string &  s  )  [inline]
 

Convert a string to an unsigned integer.

Parameters:
s string containing a number.
Returns:
unsigned long integer representation of string.

Definition at line 748 of file StringUtils.hpp.

Referenced by MSCStore::findMSC(), and ObsEphReaderFramework::initialize().

std::string c2x const std::string &  s  )  throw (StringException) [inline]
 

Convert a character string to a hexadecimal string.

Parameters:
s string containing an integer.
Returns:
string containing a sequence of hexadecimal numbers.

Definition at line 868 of file StringUtils.hpp.

Referenced by gpstk::StringUtils::printable().

std::string & c2x std::string &  s  )  throw (StringException) [inline]
 

Convert a character string to a hexadecimal string.

Modify the string such that the character string is now represented as series of hexadecimal digits.

Parameters:
s string to convert.
Returns:
reference to modified s.

Definition at line 1817 of file StringUtils.hpp.

std::string center const std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Change the length of a string by adding to the beginning and end (const version).

The string s is modified to the specified length. If the string is shorter than length, then the string is truncated with the left-most length characters remaining. Otherwise, characters are added to the beginning and end of the string until the string is the specified length, where the number of characters added to the beginning and the end does not differ by more than one so the original string is centered.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 721 of file StringUtils.hpp.

Referenced by main().

std::string & center std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Change the length of a string by adding to the beginning and end.

The string s is modified to the specified length. If the string is shorter than length, then the string is truncated with the left-most length characters remaining. Otherwise, characters are added to the beginning and end of the string until the string is the specified length, where the number of characters added to the beginning and the end does not differ by more than one so the original string is centered.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1679 of file StringUtils.hpp.

Referenced by SolarSystem::computeState(), PlanetEphemeris::computeState(), ReferenceFrames::getECEFPosition(), ReferenceFrames::getECEFVelocity(), ReferenceFrames::getJ2kPosVel(), and IERS::planetJ2kPosVel().

std::string & change std::string &  aString,
const std::string &  inputString,
const std::string &  outputString,
std::string::size_type  startPos = 0,
unsigned  numChanges = (std::numeric_limits< unsigned >::max)()
[inline]
 

Changes occurrences of a specified pattern to a specified replacement string.

You can specify the number of changes to perform. The default is to change all occurrences of the pattern. You can also specify the position in the receiver at which to begin.

Parameters:
aString string to perform translation on.
inputString The pattern string as a reference to an object of type string. The library searches for the pattern string within the receiver's data.
outputString The replacement string as a reference to an object of type string. It replaces the occurrences of the pattern string in the receiver's data.
startPos The position to start the search at within the receiver's data. The default is 0.
numChanges the number of patterns to search for and change. The default is to change all occurrences of the pattern.

Definition at line 1602 of file StringUtils.hpp.

Referenced by ObsEphReaderFramework::initialize().

std::string change const std::string &  aString,
const std::string &  inputString,
const std::string &  outputString,
std::string::size_type  startPos = 0,
unsigned  numChanges = (std::numeric_limits< unsigned >::max)()
[inline]
 

Changes occurrences of a specified pattern to a specified replacement string.

You can specify the number of changes to perform. The default is to change all occurrences of the pattern. You can also specify the position in the receiver at which to begin.

Parameters:
aString string to perform translation on.
inputString The pattern string as a reference to an object of type string. The library searches for the pattern string within the receiver's data.
outputString The replacement string as a reference to an object of type string. It replaces the occurrences of the pattern string in the receiver's data.
startPos The position to start the search at within the receiver's data. The default is 0.
numChanges the number of patterns to search for and change. The default is to change all occurrences of the pattern.

Definition at line 1593 of file StringUtils.hpp.

std::string d2x const std::string &  s  )  throw (StringException) [inline]
 

Convert a decimal string to a hexadecimal string.

Given a string containing a decimal integer, convert the integer from base 10 to base 16 and return the result. No prefix is added. Only the first decimal encountered is changed; the rest of the string is unmodified.

Parameters:
s string containing an integer.
Returns:
string containing a hexadecimal number.

Definition at line 825 of file StringUtils.hpp.

Referenced by main().

std::string & d2x std::string &  s  )  throw (StringException) [inline]
 

Convert a decimal string to a hexadecimal string.

Modify the string such that the decimal integer is now represented as hexadecimal. Only the first decimal encountered is changed; the rest of the string is unmodified.

Parameters:
s string containing an integer.
Returns:
reference to modified s.

Definition at line 1784 of file StringUtils.hpp.

std::string doub2for const double &  d,
const std::string::size_type  length,
const std::string::size_type  expLen,
const bool  checkSwitch = true
throw (StringException) [inline]
 

Convert double precision floating point to a string containing the number in FORTRAN notation.

As an example, the number 156360 becomes ".15636D6".

Parameters:
d number to convert.
length length (in characters) of number, including exponent.
expLen length (in characters of exponent, including sign.
checkSwitch if true, keeps the exponential sanity check for exponentials above three characters in length. If false, it removes that check.
Returns:
a string containing d in FORTRAN notation.

Definition at line 2609 of file StringUtils.hpp.

Referenced by SMODFData::reallyPutRecord(), SEMData::reallyPutRecord(), RinexNavHeader::reallyPutRecord(), FICData::reallyPutRecord(), SolarSystem::writeASCIIdata(), PlanetEphemeris::writeASCIIdata(), SolarSystem::writeASCIIheader(), and PlanetEphemeris::writeASCIIheader().

std::string doub2sci const double &  d,
const std::string::size_type  length,
const std::string::size_type  expLen,
const bool  showSign = true,
const bool  checkSwitch = true
[inline]
 

Convert a double to a scientific notation number.

Parameters:
d the double to convert
length length (in characters) of output, including exponent
expLen length (in characters) of the exponent, with sign
showSign if true, reserves 1 character for +/- sign
checkSwitch if true, keeps the exponential sanity check for exponentials above three characters in length. If false, it removes that check.

Definition at line 2431 of file StringUtils.hpp.

Referenced by SMODFData::doub2funny().

std::string doubleToScientific const double &  d,
const std::string::size_type  length,
const std::string::size_type  precision,
const std::string::size_type  explen,
bool  showPlus = false
[inline]
 

Convert a double to scientific notation; this routine works better, on Windows particularly, than doub2sci.

Parameters:
length = total string length, including 1 for overall sign if showPlus is true.
precision = number of digits after the decimal and before the 'e'
explen = length of exponent, this must = 1, 2 or 3 NB. length is increased if precision, explen and showPlus require it.

Definition at line 2465 of file StringUtils.hpp.

Referenced by RinexClockData::reallyPutRecord(), and Rinex3NavHeader::reallyPutRecord().

std::string firstWord const std::string &  s,
const char  delimiter = ' '
throw (StringException) [inline]
 

Returns the first word in string s without modifying the string.

Parameters:
s the string to count the words from.
delimiter the character that marks the start and end of a word.
Returns:
the first word from s;

Definition at line 2223 of file StringUtils.hpp.

Referenced by OceanLoading::initializeSites(), main(), gpstk::mixedScanTime(), gpstk::StringUtils::numWords(), ConfDataItem::parse(), and gpstk::scanTime().

double for2doub const std::string &  aStr,
const std::string::size_type  startPos = 0,
const std::string::size_type  length = std::string::npos
[inline]
 

Convert FORTRAN representation of a double precision floating point in a string to a number.

As an example, the number ".15636D6" becomes 156360.

Parameters:
aStr string containing FORTRAN representation of number.
startPos beginning of number in string.
length length (in characters) of number, including exponent.
Returns:
value of the number.

Definition at line 2640 of file StringUtils.hpp.

Referenced by SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), SolarSystem::readASCIIheader(), PlanetEphemeris::readASCIIheader(), SMODFData::reallyGetRecord(), RinexNavHeader::reallyGetRecord(), Rinex3NavHeader::reallyGetRecord(), and FICData::reallyGetRecord().

std::string formattedPrint const std::string &  fmt,
const std::string &  pat,
const std::string &  rep,
to
throw (StringException) [inline]
 

Work-horse method for printf.

Substitutes patterns matching pat with rep. Use only one pattern/token at a time! This used to be DayTime::iprint().

Parameters:
fmt format to use for this time.
pat regular expression pattern to match.
rep sprintf token replacement. First character is token character used in fmt, remainder is sprintf token to use. For example, with fmt="%15S", pat="%[ 0-]?[[:digit:]]*S", and rep="Sd", the fmt will be translated to "%15d" before using it in a sprintf call like printf("%15d"), to.
to the value to stuff into the string.
Returns:
fmt with pat replaced by to. If there is no match, fmt is returned unchanged.

Definition at line 2103 of file StringUtils.hpp.

References gpstk::StringUtils::replaceAll().

Referenced by YDSTime::printError(), UnixTime::printError(), MJD::printError(), JulianDate::printError(), GPSWeekZcount::printError(), GPSWeekSecond::printError(), GPSWeek::printError(), CivilTime::printError(), ANSITime::printError(), YDSTime::printf(), UnixTime::printf(), Position::printf(), MJD::printf(), JulianDate::printf(), GPSWeekZcount::printf(), GPSWeekSecond::printf(), GPSWeek::printf(), CivilTime::printf(), and ANSITime::printf().

void hexDumpData std::ostream &  s,
const std::string &  data,
const std::string &  tag,
HexDumpDataConfig  cfg = HexDumpDataConfig()
[inline]
 

Perform a formatted hex-dump of the (potentially) binary data to the given stream.

Parameters:
s stream to dump data to.
data data to hex-dump.
tag string to put at the beginning of each line of output.
cfg formatting configuration.

Definition at line 1369 of file StringUtils.hpp.

References cfg.

Referenced by EngAlmanac::dump(), main(), AshtechData::readBody(), MDPHeader::readHeader(), AshtechData::readHeader(), MDPHeader::reallyGetRecord(), ATSData::reallyGetRecord(), MDPHeader::reallyPutRecord(), and ATSData::reallyPutRecord().

void hexDumpData std::ostream &  s,
const std::string &  data,
unsigned  indent = 0,
HexDumpDataConfig  cfg = HexDumpDataConfig()
[inline]
 

Perform a formatted hex-dump of the (potentially) binary data to the given stream.

Parameters:
s stream to dump data to.
data data to hex-dump.
indent indents the string by that many spaces.
cfg formatting configuration.

Definition at line 1362 of file StringUtils.hpp.

References cfg.

std::string int2x const unsigned int &  i  )  throw (StringException) [inline]
 

Convert an int to a string.

Parameters:
i the integer to convert
Returns:
a string with the hex equivalent of i

Definition at line 1910 of file StringUtils.hpp.

References GPSTK_RETHROW.

bool isAlphaString const std::string &  s  )  [inline]
 

isAlphaString is exactly like the C function isAlpha except it checks all the characters of string s to see if they are all alphabet characters.

Parameters:
s the string to check the characters in.
Returns:
true if s is all digits, false otherwise.

Definition at line 2004 of file StringUtils.hpp.

Referenced by CommandOptionWithStringArg::checkArguments().

bool isDecimalString const std::string &  s  )  [inline]
 

isDecimalString is like isDigitString() except it allows a single period ('.') character in the string.

Parameters:
s the string to check.
Returns:
true if s is a valid fixed-point number.

Definition at line 1967 of file StringUtils.hpp.

References index().

bool isDigitString const std::string &  s  )  [inline]
 

isDigitString is exactly like the C function isDigit except it checks all the characters of string s to see if they are all digits.

Parameters:
s the string to check the digits in.
Returns:
true if s is all digits, false otherwise.

Definition at line 1953 of file StringUtils.hpp.

Referenced by CommandOptionWithNumberArg::checkArguments(), MSCStore::findMSC(), EOPDataStore::loadSTKFile(), and ConfDataItem::parse().

bool isLike const std::string &  s,
const char *  pPattern,
const char  zeroOrMore = '*',
const char  oneOrMore = '+',
const char  anyChar = '.'
throw (StringException) [inline]
 

Perform pattern matching on strings.

Looks for a pattern in a string. Wildcards are allowed. Uses POSIX regular expressions.

Parameters:
s string to search.
pPattern pattern to search for. This is a POSIX regular expression.
zeroOrMore character representing wildcards matching strings of zero or more characters (default '*').
oneOrMore character representing plus sign matching strings of one or more characters (default '+').
anyChar character representing wildcards matching a single arbitrary character (default '.').
Returns:
t if a match is found, f if not.

Definition at line 999 of file StringUtils.hpp.

Referenced by main(), gpstk::mixedScanTime(), gpstk::scanTime(), FileHunter::searchHelper(), and CivilTime::setFromInfo().

bool isLike const std::string &  s,
const std::string &  aPattern,
const char  zeroOrMore = '*',
const char  oneOrMore = '+',
const char  anyChar = '.'
throw (StringException) [inline]
 

Perform pattern matching on strings.

Looks for a pattern in a string. Wildcards are allowed. Uses POSIX regular expressions.

Parameters:
s string to search.
aPattern pattern to search for. This is a POSIX regular expression.
zeroOrMore character representing wildcards matching strings of zero or more characters (default '*').
oneOrMore character representing plus sign matching strings of one or more characters (default '+').
anyChar character representing wildcards matching a single arbitrary character (default '.').
Returns:
t if a match is found, f if not.

Definition at line 974 of file StringUtils.hpp.

bool isScientificString const std::string &  s  )  [inline]
 

isScientificString extends isDecimalString() to allow a single exponent (E,e,D,d) character between a decimal string and a (possibly empty) digit string.

Parameters:
s the string to check.
Returns:
true if s is a valid scientific-notation number.

Definition at line 1990 of file StringUtils.hpp.

std::string leftJustify const std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Left-justifies the receiver in a string of the specified length (const version).

If the new length (length) is larger than the current length, the string is extended by the pad character (pad). The default pad character is a blank.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 675 of file StringUtils.hpp.

Referenced by gpstk::DisplayExtendedRinexObsTypes(), GDCconfiguration::DisplayParameterUsage(), gpstk::DisplayStandardRinexObsTypes(), CommandOptionParser::displayUsage(), dtft(), gpstk::dumpGnssDataMap(), main(), gpstk::operator<<(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), SP3Data::reallyGetRecord(), SP3Header::reallyPutRecord(), SEMHeader::reallyPutRecord(), RinexNavHeader::reallyPutRecord(), RinexMetHeader::reallyPutRecord(), RinexClockHeader::reallyPutRecord(), Rinex3NavHeader::reallyPutRecord(), MSCData::reallyPutRecord(), IonexData::reallyPutRecord(), FICHeader::reallyPutRecord(), AntexData::reallyPutRecord(), SolarSystem::writeASCIIdata(), PlanetEphemeris::writeASCIIdata(), SolarSystem::writeASCIIheader(), PlanetEphemeris::writeASCIIheader(), SolarSystem::writeBinaryFile(), PlanetEphemeris::writeBinaryFile(), RinexObsHeader::WriteHeaderRecords(), Rinex3ObsHeader::WriteHeaderRecords(), IonexHeader::WriteHeaderRecords(), AntexHeader::WriteHeaderRecords(), ConfDataWriter::writeVariable(), and ConfDataWriter::writeVariableList().

std::string & leftJustify std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Left-justifies the receiver in a string of the specified length.

If the new length (length) is larger than the current length, the string is extended by the pad character (pad). The default pad character is a blank.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1653 of file StringUtils.hpp.

std::string lowerCase const std::string &  s  )  [inline]
 

Change all upper-case letters in a string to lower-case.

Does not modify the original string.

Parameters:
s a string containing upper-case characters.
Returns:
a copy of the original string, all in lower-case.

Definition at line 1056 of file StringUtils.hpp.

References gpstk::StringUtils::upperCase().

Referenced by SatOrbitStore::loadGNV1BFile(), gpstk::mixedScanTime(), gpstk::scanTime(), and CivilTime::setFromInfo().

std::string & lowerCase std::string &  s  )  [inline]
 

Change all upper-case letters in a string to lower-case.

s is modified as a result.

Parameters:
s string to change to lower case.
Returns:
a copy of the original string, all in lower-case.

Definition at line 2193 of file StringUtils.hpp.

std::string matches const std::string &  s,
const std::string &  aPattern,
const char  zeroOrMore = '*',
const char  oneOrMore = '+',
const char  anyChar = '.'
throw (StringException) [inline]
 

Perform pattern matching on strings.

Looks for a pattern in a string. Wildcards are allowed. Uses POSIX regular expressions.

Parameters:
s string to search.
aPattern pattern to search for. This is a POSIX regular expression.
zeroOrMore character representing wildcards matching strings of zero or more characters (default '*').
oneOrMore character representing plus sign matching strings of one or more characters (default '+').
anyChar character representing wildcards matching a single arbitrary character (default '.').
Returns:
string representing the first match of aPattern in s. Returns a null string if no match is found.

Definition at line 2016 of file StringUtils.hpp.

References gpstk::StringUtils::replaceAll().

Referenced by EOPStore::addFile(), and main().

std::string memToString const void *  p,
const std::string::size_type  size
[inline]
 

Make a string from a void pointer.

This function should not be used. Instead, use the string constructor as follows:

 string((char*)p, size); 
Parameters:
p pointer to memory.
size length of the data to turn into a string.
Returns:
string object containing the contents of p.

Definition at line 2211 of file StringUtils.hpp.

int numWords const std::string &  s,
const char  delimiter = ' '
throw (StringException) [inline]
 

Counts the number of words in s and returns it.

Parameters:
s the string to count the words from.
delimiter the character that marks the start and end of a word.
Returns:
the number of words in s.

Definition at line 2257 of file StringUtils.hpp.

References gpstk::StringUtils::firstWord(), and gpstk::StringUtils::stripLeading().

Referenced by ConfDataReader::getNumItem(), CommandOptionWithSimpleTimeArg::getTimeSpec(), ObsEphReaderFramework::initialize(), OceanLoading::initializeSites(), and main().

std::string prettyPrint const std::string &  aStr,
const std::string &  lineDelim = "\n",
const std::string &  indent = "",
const std::string &  firstIndent = "     ",
const std::string::size_type  len = 80,
const char  wordDelim = ' '
throw (StringException) [inline]
 

Const version of prettyPrint, which nicely expands the input string into several lines.

Parameters:
aStr the string to be modified.
lineDelim a string to put between every line.
indent an indentataion string used on all but the first line
firstIndent is the indentation used on the first line.
len the maximum length of string to put on a line.
wordDelim the character that separates each word.
Returns:
the string nicely formatted.

Definition at line 1305 of file StringUtils.hpp.

Referenced by CommandOptionParser::displayUsage(), CommandOption::getDescription(), and main().

std::string & prettyPrint std::string &  aStr,
const std::string &  lineDelim = "\n",
const std::string &  indent = "",
const std::string &  firstIndent = "     ",
const std::string::size_type  len = 80,
const char  wordDelim = ' '
throw (StringException) [inline]
 

Nicely expands the input string into several lines, non-const version.

Parameters:
aStr the string to be modified.
lineDelim a string to put between every line.
indent an indentataion string used on all but the first line
firstIndent is the indentation used on the first line.
len the maximum length of string to put on a line.
wordDelim the character that separates each word.
Returns:
the string nicely formatted.

Definition at line 2711 of file StringUtils.hpp.

std::string printable const std::string &  aStr  )  throw (StringException) [inline]
 

Change a string into printable characters.

Control characters (0-26) are changed to ^@, ^A, etc. Other non-printable characters are changed to hex sequences enclosed in <>.

Parameters:
aStr the string to make printable.

Definition at line 2673 of file StringUtils.hpp.

References gpstk::StringUtils::c2x().

Referenced by main().

std::string & removeWords std::string &  s,
const std::string::size_type  first = 0,
const std::string::size_type  wordsToReplace = std::string::npos,
const char  delimiter = ' '
throw (StringException) [inline]
 

Removes indicated words from the string s.

s is modified as a result.

Parameters:
s a string with the words you want removed.
first the first word to be removed (the first word is 0).
wordsToReplace the number of words you want removed.
delimiter the character that marks the start and end of a word.
Returns:
a reference to string s with the words removed.

Definition at line 2378 of file StringUtils.hpp.

Referenced by main().

std::string & replaceAll std::string &  s,
const std::string &  oldString,
const std::string &  newString
throw (StringException) [inline]
 

Replace all instances of oldString with newString in s.

Parameters:
s the string whose contents will be modified.
oldString the string to search for in s.
newString the string to replace oldString in s.
Returns:
a reference to the modified string.

Definition at line 1930 of file StringUtils.hpp.

Referenced by gpstk::StringUtils::formattedPrint(), main(), and gpstk::StringUtils::matches().

std::string rightJustify const std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Right-justifies the receiver in a string of the specified length (const version).

If the receiver's data is shorter than the requested length (length), it is padded on the left with the pad character (pad). The default pad character is a blank.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 642 of file StringUtils.hpp.

Referenced by RinexClockHeader::dump(), FileHunter::filterHelper(), main(), gpstk::operator<<(), SP3Header::reallyPutRecord(), SP3Data::reallyPutRecord(), SMODFData::reallyPutRecord(), SEMHeader::reallyPutRecord(), SEMData::reallyPutRecord(), RinexObsData::reallyPutRecord(), RinexNavHeader::reallyPutRecord(), RinexMetHeader::reallyPutRecord(), RinexMetData::reallyPutRecord(), RinexClockHeader::reallyPutRecord(), RinexClockData::reallyPutRecord(), Rinex3ObsData::reallyPutRecord(), Rinex3NavHeader::reallyPutRecord(), MSCData::reallyPutRecord(), IonexData::reallyPutRecord(), AntexData::reallyPutRecord(), gpstk::reallyPutRecordVer2(), IonexHeader::DCB::toString(), FileSpec::toString(), SolarSystem::writeASCIIheader(), PlanetEphemeris::writeASCIIheader(), RinexObsHeader::WriteHeaderRecords(), Rinex3ObsHeader::WriteHeaderRecords(), IonexHeader::WriteHeaderRecords(), and AntexHeader::WriteHeaderRecords().

std::string & rightJustify std::string &  s,
const std::string::size_type  length,
const char  pad = ' '
throw (StringException) [inline]
 

Right-justifies the receiver in a string of the specified length.

If the receiver's data is shorter than the requested length (length), it is padded on the left with the pad character (pad). The default pad character is a blank.

Parameters:
s string to be modified.
length new desired length of string.
pad character to pad string with (blank by default).
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1627 of file StringUtils.hpp.

std::string & sci2for std::string &  aStr,
const std::string::size_type  startPos = 0,
const std::string::size_type  length = std::string::npos,
const std::string::size_type  expLen = 3,
const bool  checkSwitch = true
throw (StringException) [inline]
 

Convert scientific notation to FORTRAN notation.

As an example, the string "1.5636E5" becomes " .15636D6". Note that the first character of the string will be '-' if the number is negative or ' ' if the first character is positive.

Parameters:
aStr string with number to convert
startPos start position of number in string
length length (in characters) of number, including exponent.
expLen length (in characters of exponent, not including sign.
checkSwitch will keep the method running as orignially programed when set to true. If false, the method will always resize exponentials, produce an exponential with an E instead of a D, and always have a leading zero. For example -> 0.87654E-0004 or -0.1234E00005.
Exceptions:
Exception if the string is not a number in scientific notation

Definition at line 2506 of file StringUtils.hpp.

References GPSTK_THROW.

std::vector<std::string> split const std::string &  aStr,
const std::string &  theDelimiters = " ",
bool  trimWhitespace = false,
bool  ignoreEmpty = true
[inline]
 

Split a string by some delimiters.

Parameters:
aStr the string to be splitted
theDelimiters the delimiters to split the string
trimWhitespace will trim the token string, default is false
ignoreEmpty will ignore the empty tokens, default is true

Definition at line 1324 of file StringUtils.hpp.

References gpstk::StringUtils::strip().

Referenced by SRI::reshape().

std::vector< std::string > split const std::string &  str,
const char  delimiter = ' '
throw (StringException) [inline]
 

Split a string str into words as defined by delimiter.

Parameters:
str string to be parsed.
delimiter character that marks the start and end of a word.
Returns:
a vector of the words (strings)

Definition at line 2355 of file StringUtils.hpp.

std::string strip const std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the beginning and end of a string const version.

Occurrences of the space character appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 544 of file StringUtils.hpp.

Referenced by ConfDataReader::fetchListValue(), ConfDataItem::format(), AntexReader::getAntenna(), AntexReader::getAntennaNoRadome(), SatOrbitStore::loadGNV1BFile(), ProblemSatFilter::loadSatelliteProblemFile(), main(), ConfDataItem::parse(), IonexHeader::ParseDcbRecord(), RinexObsHeader::ParseHeaderRecord(), Rinex3ObsHeader::ParseHeaderRecord(), Rinex3ClockHeader::ParseHeaderRecord(), IonexHeader::ParseHeaderRecord(), RinexNavHeader::reallyGetRecord(), RinexMetHeader::reallyGetRecord(), RinexClockHeader::reallyGetRecord(), RinexClockData::reallyGetRecord(), Rinex3NavHeader::reallyGetRecord(), and gpstk::StringUtils::split().

std::string& strip std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the beginning and end of a string.

Occurrences of the space character appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 530 of file StringUtils.hpp.

std::string strip const std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the beginning and end of a string const version.

Occurrences of the character aCharacter appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 515 of file StringUtils.hpp.

std::string& strip std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the beginning and end of a string.

Occurrences of the character aCharacter appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 499 of file StringUtils.hpp.

std::string strip const std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning and end of another string cosnt version.

Occurrences of the string pString appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 483 of file StringUtils.hpp.

std::string& strip std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning and end of another string.

Occurrences of the string pString appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 467 of file StringUtils.hpp.

std::string strip const std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning and end of another string const version.

Occurrences of the string aString appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 450 of file StringUtils.hpp.

std::string & strip std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning and end of another string.

Occurrences of the string aString appearing at the beginning and end of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1553 of file StringUtils.hpp.

std::string stripFirstWord std::string &  s,
const char  delimiter = ' '
throw (StringException) [inline]
 

Removes the first word off string s and returns it.

s is modified as a result.

Parameters:
s a string with the word you want removed.
delimiter the character that marks the start and end of a word.
Returns:
the first word from s

Definition at line 2332 of file StringUtils.hpp.

Referenced by expand_args(), expand_list_file(), OceanLoading::initializeSites(), main(), ConfDataItem::parse(), Rinex3ClockHeader::ParseHeaderRecord(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), SolarSystem::readASCIIheader(), and PlanetEphemeris::readASCIIheader().

std::string stripLeading const std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the beginning of a string const version.

Occurrences of the space character appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 296 of file StringUtils.hpp.

Referenced by MSCStore::addMSC(), gpstk::StringUtils::asString(), expand_filename(), expand_list_file(), MSCStore::findMSC(), TimeTag::getInfo(), FileSpec::init(), OceanLoading::initializeSites(), YumaData::lineParser(), ProblemSatFilter::loadSatelliteProblemFile(), main(), gpstk::StringUtils::numWords(), SolarSystem::readASCIIheader(), PlanetEphemeris::readASCIIheader(), and Position::setToString().

std::string& stripLeading std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the beginning of a string.

Occurrences of the space character appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 282 of file StringUtils.hpp.

std::string stripLeading const std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the beginning of a string const version.

Occurrences of the character aCharacter appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 267 of file StringUtils.hpp.

std::string& stripLeading std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the beginning of a string.

Occurrences of the character aCharacter appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 251 of file StringUtils.hpp.

std::string stripLeading const std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning of another string const version.

Occurrences of the string pString appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 235 of file StringUtils.hpp.

std::string& stripLeading std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning of another string.

Occurrences of the string pString appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 219 of file StringUtils.hpp.

std::string stripLeading const std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning of another string const version.

Occurrences of the string aString appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 203 of file StringUtils.hpp.

std::string & stripLeading std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the beginning of another string.

Occurrences of the string aString appearing at the beginning of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1495 of file StringUtils.hpp.

std::string stripTrailing const std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the end of a string const version.

Occurrences of the space character appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 419 of file StringUtils.hpp.

Referenced by EOPStore::addIERSFile(), MSCStore::addMSC(), expand_filename(), expand_list_file(), MSCStore::findMSC(), include_path(), OceanLoading::initializeSites(), EOPPrediction::loadFile(), EOPDataStore::loadIERSFile(), EOPDataStore::loadIGSFile(), ProblemSatFilter::loadSatelliteProblemFile(), main(), AntexHeader::ParseHeaderRecord(), CommandLine::ProcessCommandLine(), SolarSystem::readASCIIdata(), PlanetEphemeris::readASCIIdata(), SolarSystem::readASCIIheader(), PlanetEphemeris::readASCIIheader(), RinexObsHeader::reallyGetRecord(), RinexObsData::reallyGetRecord(), RinexNavHeader::reallyGetRecord(), RinexClockHeader::reallyGetRecord(), RinexClockData::reallyGetRecord(), Rinex3ObsHeader::reallyGetRecord(), Rinex3ObsData::reallyGetRecord(), Rinex3NavHeader::reallyGetRecord(), Rinex3ClockHeader::reallyGetRecord(), IonexHeader::reallyGetRecord(), IonexData::reallyGetRecord(), AntexHeader::reallyGetRecord(), AntexData::reallyGetRecord(), gpstk::reallyGetRecordVer2(), Rinex3NavHeader::reallyPutRecord(), gpstk::RegisterExtendedRinexObsType(), and Position::setToString().

std::string& stripTrailing std::string &  s,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip blanks from the end of a string.

Occurrences of the space character appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 405 of file StringUtils.hpp.

std::string stripTrailing const std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the end of a string const version.

Occurrences of the character aCharacter appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 390 of file StringUtils.hpp.

std::string& stripTrailing std::string &  s,
const char  aCharacter,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Strip character(s) from the end of a string.

Occurrences of the character aCharacter appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
aCharacter character to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 374 of file StringUtils.hpp.

std::string stripTrailing const std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the end of another string const version.

Occurrences of the string pString appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 358 of file StringUtils.hpp.

std::string& stripTrailing std::string &  s,
const char *  pString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the end of another string.

Occurrences of the string pString appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
pString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 342 of file StringUtils.hpp.

std::string stripTrailing const std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the end of another string const version.

Occurrences of the string aString appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 326 of file StringUtils.hpp.

std::string & stripTrailing std::string &  s,
const std::string &  aString,
std::string::size_type  num = std::string::npos
throw (StringException) [inline]
 

Remove a string from the end of another string.

Occurrences of the string aString appearing at the end of the string s are removed.

Parameters:
s string to be stripped (modified).
aString string to remove.
num maximum number of occurrences to remove.
Exceptions:
StringException if there's a std::exception thrown.
Returns:
a reference to s.

Definition at line 1523 of file StringUtils.hpp.

Referenced by FFTextStream::formattedGetLine().

std::string subString const std::string &  s,
const std::string::size_type  startPos = 0,
const std::string::size_type  length = std::string::npos,
const char  pad = ' '
throw (StringException) [inline]
 

Get a substring of a string.

Try to avoid using this, use the stl string's substr method instead (and leftJustify if needed).

Definition at line 2167 of file StringUtils.hpp.

std::string translate const std::string &  aString,
const std::string &  inputChars,
const std::string &  outputChars,
const char  pad = ' '
[inline]
 

Converts all of the receiver's characters that are in the first specified string to the corresponding character in the second specified string.

Parameters:
aString string to perform translation on.
inputChars characters in aString to translate from.
outputChars characters to translate to.
pad pad character in the event inputChars and outputChars are not equal length. The pad character will become the translated character.

Definition at line 1563 of file StringUtils.hpp.

Referenced by main().

std::string upperCase const std::string &  s  )  [inline]
 

Change all lower-case letters in a string to upper-case.

Does not modify the original string.

Parameters:
s a string containing lower-case characters.
Returns:
a copy of the original string, all in upper-case.

Definition at line 1073 of file StringUtils.hpp.

Referenced by ConfDataReader::fetchListValue(), ConfDataReader::fetchListValueAsBoolean(), AntexReader::getAntenna(), AntexReader::getAntennaNoRadome(), ConfDataReader::getValue(), ConfDataReader::getValueAsBoolean(), ConfDataReader::getValueDescription(), ConfDataReader::getVariableDescription(), ConfDataReader::ifExist(), gnssConfData::keepOnly(), gpstk::StringUtils::lowerCase(), ConfDataItem::parse(), SP3Header::reallyGetRecord(), RinexClockHeader::reallyGetRecord(), and Expression::set().

std::string & upperCase std::string &  s  )  [inline]
 

Change all lower-case letters in a string to upper-case.

s is modified as a result.

Parameters:
s string to change to upper case.
Returns:
a copy of the original string, all in upper-case.

Definition at line 2202 of file StringUtils.hpp.

std::string word const std::string &  s,
const std::string::size_type  wordNum = 0,
const char  delimiter = ' '
throw (StringException) [inline]
 

Returns word number wordNum from s (if any).

Parameters:
s a string with the word you want removed.
wordNum the number of the word you want from s. The first word is word 0.
delimiter the character that marks the start and end of a word.
Returns:
the first word from s or an empty string if there is no wordNum'th word.

Definition at line 1138 of file StringUtils.hpp.

Referenced by AshtechEPB::decode(), AshtechALB::decode(), PackedNavBits::dump(), AshtechEPB::dump(), expand_list_file(), GDCreturn::GDCreturn(), FICData::getElementLabel(), ObsEphReaderFramework::initialize(), OceanLoading::initializeSites(), EOPPrediction::loadFile(), main(), PackedNavBits::outputPackedBits(), Rinex3ClockHeader::ParseHeaderRecord(), CommandLine::ProcessCommandLine(), SolarSystem::readASCIIheader(), and PlanetEphemeris::readASCIIheader().

std::string words const std::string &  s,
const std::string::size_type  firstWord = 0,
const std::string::size_type  numWords = std::string::npos,
const char  delimiter = ' '
throw (StringException) [inline]
 

Returns numWords words starting with firstWord from s (if any).

Parameters:
s a string with the word you want removed.
firstWord the number of the first word you want from s. The first word is word 0.
numWords number of words to get from s.
delimiter the character that marks the start and end of a word.
Returns:
the first word from s or an empty string if there is no wordNum'th word.

Definition at line 2286 of file StringUtils.hpp.

Referenced by GDCreturn::GDCreturn(), and main().

std::string x2d const std::string &  s  )  throw (StringException) [inline]
 

Convert a hexadecimal string to a decimal string.

Given a string containing a hexadecimal number, convert the integer from base 16 to base 10 and return the result. Only the first hex number encountered is changed; the rest of the string is unmodified.

Parameters:
s string containing an integer.
Returns:
string containing a hexadecimal number.

Definition at line 849 of file StringUtils.hpp.

Referenced by main().

std::string & x2d std::string &  s  )  throw (StringException) [inline]
 

Modify the string such that the hexadecimal number is now represented as decimal. Only the first hex number encountered is changed; the rest of the string is unmodified.

Parameters:
s string containing an integer.
Returns:
reference to modified s.

Definition at line 1876 of file StringUtils.hpp.

unsigned int x2uint const std::string &  s  )  throw (StringException) [inline]
 

Only the first hex number encountered is converted.

Parameters:
s string containing a hex integer.
Returns:
a long holding the value of s.

Definition at line 1851 of file StringUtils.hpp.

Referenced by PackedNavBits::rawBitInput().


Generated on Sun May 19 03:31:37 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1