Description

Typedefs

   
   
typedef std::pair< const std::string, std::string > keyValuePair

Variables

   
   
const uint32_t INVALID_UNICODE_CODE_POINT

Functions

   
   
bool beginsWith(const char * subject, const char * find)
Does subject begin withfind?
   
bool beginsWith(std::istream & is, const std::string & find)
   
std::string createRandomString(size_t length)
Create a random string out of digits, and lower and uppercase letters.
   
std::string escape(const std::string & s)
Escape quotes, newlines and backslashes.
   
void extractFloats(const std::string & in, std::deque< float > & out)
   
void extractUnsignedLongs(const std::string & in, std::deque< unsigned long > & out)
   
std::string getLine(const char * subject)
template< typename Iterator_T >  
std::string implode(const Iterator_T & begin, const Iterator_T & end, const std::string & delimiter)
   
bool nextLine(const char * subject, int & cursor)
Move cursor to the next line. Return false if end of subject is reached.
   
std::pair< uint32_t, uint8_t > readUTF8Codepoint(const std::string & str, const size_t pos)
   
std::string readQuotedString(const char * subject, int & cursor)
   
std::string replaceAll(const std::string & subject, const std::string & find, const std::string & replace, int count)
Replace all(or maximal count) occurrences of find in subject by replace.
   
std::string replaceMultiple(const std::string & subject, int replaceCount, const std::string find, const std::string replace, int max)
   
std::string replaceMultiple(const std::string & subject, const std::deque< keyValuePair > & findReplace, int max)
   
bool stepText(const char * subject, int & cursor, const char * search)
   
void stepWhitespaces(const char * subject, int & cursor)
Whitespace chars are skipped.
   
void stepWhitespaces(std::istream & is)
   
void stepWhitespaces(std::istream & is, int & line)
   
void stepWhitespaces(char ** cursor)
template< typename _T >  
_T toNumber(const std::string & in)
   
bool toBool(const std::string & s)
   
std::deque< bool > toBools(const std::string & s)
e.g. “0 1 -4 6.0” -> [false, true, true, true]
   
std::vector< float > toFloats(const std::string & s)
e.g. “0 1 -4 6.0” -> [0.0f,1.0f,-4.0f,6.0f]
   
std::vector< int > toInts(const std::string & s)
e.g. “0 1 -4 6.0” -> [0, 1, -4, 6]
   
std::string trim(const std::string & s)
Strip all whitespaces from the beginning and ending of s.
   
std::string toFormattedString(float i)
template< typename Type >  
std::string toString(Type var)
template< >  
std::string toString< unsigned char >(unsigned char var)
template< >  
std::string toString< signed char >(signed char var)
template< >  
std::string toString< char >(char var)
template< >  
std::string toString< const std::string & >(const std::string & var)
   
std::u32string utf8_to_utf32(const std::string & str_u8)
   
std::string utf32_to_utf8(const std::u32string & str_u32)
   
std::string utf32_to_utf8(const uint32_t u32)

Documentation

typedef
Util::StringUtils::keyValuePair

public
 
 
typedef std::pair< const std::string, std::string > keyValuePair

Defined in Util/StringUtils.h:89


variable
Util::StringUtils::INVALID_UNICODE_CODE_POINT

public static
 
 
const uint32_t INVALID_UNICODE_CODE_POINT

Defined in Util/StringUtils.h:76


function
Util::StringUtils::beginsWith

public
     
     
bool beginsWith( const char * subject,
  const char * find
)    

Does subject begin withfind?

Defined in Util/StringUtils.h:31


function
Util::StringUtils::beginsWith

public
     
     
bool beginsWith( std::istream & is,
  const std::string & find
)    

Defined in Util/StringUtils.h:32


function
Util::StringUtils::createRandomString

public
     
     
std::string createRandomString( size_t length )

Create a random string out of digits, and lower and uppercase letters.

Defined in Util/StringUtils.h:35


function
Util::StringUtils::escape

public
     
     
std::string escape( const std::string & s )

Escape quotes, newlines and backslashes.

Defined in Util/StringUtils.h:38


function
Util::StringUtils::extractFloats

public
     
     
void extractFloats( const std::string & in,
  std::deque< float > & out
)    

Convert the given string containing white space separated number representations and append the numbers to the given double-ended queue.

Parameters

in
String which is taken as input of the conversion.
out
Double-ended queue that is used to add the numbers.

Note: ** Use toFloats(…) instead! ***

Defined in Util/StringUtils.h:47


function
Util::StringUtils::extractUnsignedLongs

public
     
     
void extractUnsignedLongs( const std::string & in,
  std::deque< unsigned long > & out
)    

Convert the given string containing white space separated number representations and append the numbers to the given double-ended queue.

Parameters

in
String which is taken as input of the conversion.
out
Double-ended queue that is used to add the numbers.

Defined in Util/StringUtils.h:55


function
Util::StringUtils::getLine

public
     
     
std::string getLine( const char * subject )

Read the next line.

Defined in Util/StringUtils.h:58


function
Util::StringUtils::implode

public
     
template< typename Iterator_T >    
std::string implode( const Iterator_T & begin,
  const Iterator_T & end,
  const std::string & delimiter
)    

Defined in Util/StringUtils.h:61


function
Util::StringUtils::nextLine

public
     
     
bool nextLine( const char * subject,
  int & cursor
)    

Move cursor to the next line. Return false if end of subject is reached.

Defined in Util/StringUtils.h:74


function
Util::StringUtils::readUTF8Codepoint

public
     
     
std::pair< uint32_t, uint8_t > readUTF8Codepoint( const std::string & str,
  const size_t pos
)    

Reads the next UTF8 code point from the givenstringat the givenpos.

Returns

[UnicodeCodePoint, numberOfBytes]; If the code point lies beyond the string, numberOfBytes is 0. If no valid code point could be read (e.g. formatting error), UnicodeCodePoint is INVALID_UNICODE_CODE_POINT.

Defined in Util/StringUtils.h:82


function
Util::StringUtils::readQuotedString

public
     
     
std::string readQuotedString( const char * subject,
  int & cursor
)    

Read and return the content of a quoted string “foo bar”. The cursor is placed after the string. If no quoted string is found at the beginning of the stream, the cursor is not moved.

Defined in Util/StringUtils.h:86


function
Util::StringUtils::replaceAll

public
     
     
std::string replaceAll( const std::string & subject,
  const std::string & find,
  const std::string & replace,
  int count
)    

Replace all(or maximal count) occurrences of find in subject by replace.

Defined in Util/StringUtils.h:92


function
Util::StringUtils::replaceMultiple

public
     
     
std::string replaceMultiple( const std::string & subject,
  int replaceCount,
  const std::string find,
  const std::string replace,
  int max
)    

Defined in Util/StringUtils.h:93


function
Util::StringUtils::replaceMultiple

public
     
     
std::string replaceMultiple( const std::string & subject,
  const std::deque< keyValuePair > & findReplace,
  int max
)    

Defined in Util/StringUtils.h:94


function
Util::StringUtils::stepText

public
     
     
bool stepText( const char * subject,
  int & cursor,
  const char * search
)    

If subject[cursor] begins withsearch, thecursoris moved behind that text and true is returned. Otherwise, false is returned.

Defined in Util/StringUtils.h:98


function
Util::StringUtils::stepWhitespaces

public
     
     
void stepWhitespaces( const char * subject,
  int & cursor
)    

Whitespace chars are skipped.

Defined in Util/StringUtils.h:101


function
Util::StringUtils::stepWhitespaces

public
     
     
void stepWhitespaces( std::istream & is )

Defined in Util/StringUtils.h:102


function
Util::StringUtils::stepWhitespaces

public
     
     
void stepWhitespaces( std::istream & is,
  int & line
)    

Defined in Util/StringUtils.h:103


function
Util::StringUtils::stepWhitespaces

public
     
     
void stepWhitespaces( char ** cursor )

Defined in Util/StringUtils.h:104


function
Util::StringUtils::toNumber

public static inline
     
template< typename _T >    
_T toNumber( const std::string & in )

Convert the given string to a number.

Parameters

in
String containing a number representation.

Returns

Number as type determined by template parameter.

Defined in Util/StringUtils.h:113


function
Util::StringUtils::toBool

public
     
     
bool toBool( const std::string & s )

Defined in Util/StringUtils.h:119


function
Util::StringUtils::toBools

public
     
     
std::deque< bool > toBools( const std::string & s )

e.g. “0 1 -4 6.0” -> [false, true, true, true]

Defined in Util/StringUtils.h:122


function
Util::StringUtils::toFloats

public
     
     
std::vector< float > toFloats( const std::string & s )

e.g. “0 1 -4 6.0” -> [0.0f,1.0f,-4.0f,6.0f]

Defined in Util/StringUtils.h:124


function
Util::StringUtils::toInts

public
     
     
std::vector< int > toInts( const std::string & s )

e.g. “0 1 -4 6.0” -> [0, 1, -4, 6]

Defined in Util/StringUtils.h:126


function
Util::StringUtils::trim

public
     
     
std::string trim( const std::string & s )

Strip all whitespaces from the beginning and ending of s.

Defined in Util/StringUtils.h:129


function
Util::StringUtils::toFormattedString

public
     
     
std::string toFormattedString( float i )

Defined in Util/StringUtils.h:131


function
Util::StringUtils::toString

public
     
template< typename Type >    
std::string toString( Type var )

Defined in Util/StringUtils.h:134


function
Util::StringUtils::toString< unsigned char >

public inline
     
template< >    
std::string toString< unsigned char >( unsigned char var )

Defined in Util/StringUtils.h:139


function
Util::StringUtils::toString< signed char >

public inline
     
template< >    
std::string toString< signed char >( signed char var )

Defined in Util/StringUtils.h:142


function
Util::StringUtils::toString< char >

public inline
     
template< >    
std::string toString< char >( char var )

Defined in Util/StringUtils.h:145


function
Util::StringUtils::toString< const std::string & >

public inline
     
template< >    
std::string toString< const std::string & >( const std::string & var )

Defined in Util/StringUtils.h:148


function
Util::StringUtils::utf8_to_utf32

public
     
     
std::u32string utf8_to_utf32( const std::string & str_u8 )

Defined in Util/StringUtils.h:152


function
Util::StringUtils::utf32_to_utf8

public
     
     
std::string utf32_to_utf8( const std::u32string & str_u32 )

Defined in Util/StringUtils.h:153


function
Util::StringUtils::utf32_to_utf8

public
     
     
std::string utf32_to_utf8( const uint32_t u32 )

Defined in Util/StringUtils.h:154