Loading...
Searching...
No Matches
BALL::String Class Reference
Foundation Classes » General datastructures » Miscellaneous » String

`#include <BALL/DATATYPE/string.h>`

## Public Member Functions

virtual void * | create (bool=true, bool empty=false) const
Constructors and Destructors
| String ()
| Default Constructor.
| String (const string &string)
| STL string copy constructor.
| String (const String &s)
| Copy constructor.
| String (String &&s)
| Move constructor.
| String (string &&s)
| Move constructor for STL string.
String & | operator= (String &&s)
| Move assigment operator.
String & | operator= (string &&s)
| Move assignment operator for STL string.
| String (const QString &string)
| QString copy constructor.
| String (const QByteArray &string)
| QByteArray copy constructor.
| String (const String &s, Index from, Size len=EndPos)
| String (const char *char_ptr, Index from=0, Size len=EndPos)
| String (Size buffer_size, const char *format,...)
| String (std::stringstream &s)
| String (const char c, Size len=1)
| String (const unsigned char uc)
| Creates a string just containing an unsigned character.
| String (short s)
| Construct a String from a short.
| String (unsigned short us)
| Construct a String from an unsigned short.
| String (int i)
| Construct a String from an int.
| String (unsigned int ui)
| Construct a String from an unsigned int.
| String (long l)
| Construct a String from a long.
| String (unsigned long)
| Construct a String from an unsigned long.
| String (float f)
| Construct a String from a float value.
| String (double d)
| Construct a String from a double value.
| operator string & ()
| Cast the String to a std::string reference.
| operator string const & () const
| Cast the String to a std::string reference, const version.
virtual | ~String ()
| Destructor.
void | destroy ()
| Clear the string (reset to the empty string).
Assignment methods
void | set (const String &s)
void | set (const String &string, Index from, Size len=EndPos)
void | set (const char *char_ptr, Index from=0, Size len=EndPos)
void | set (Size buffer_size, const char *format,...)
void | set (std::stringstream &s)
void | set (char c, Size len=1)
| Assign a String from the result of repeating c len times.
void | set (unsigned char uc)
| Assign a String from an unsigned char.
void | set (short s)
| Assign a String from a short.
void | set (unsigned short us)
| Assign a String from an unsigned short.
void | set (int i)
| Assign a String from an int.
void | set (unsigned int ui)
| Assign a String from an unsigned int.
void | set (long l)
| Assign a String from a long.
void | set (unsigned long ul)
| Assign a String from an unsigned long.
void | set (float f)
| Assign a String from a float value.
void | set (double d)
| Assign a String from a double value.
void | get (char *char_ptr, Index from=0, Size len=EndPos) const
const String & | operator= (const String &s)
| Assign a String from another String.
const String & | operator= (const char *pc)
const String & | operator= (std::stringstream &s)
const String & | operator= (char c)
| Assign a String from a single char.
const String & | operator= (unsigned char uc)
| Assign a String from an unsigned char.
const String & | operator= (short s)
| Assign a String from a short.
const String & | operator= (unsigned short us)
| Assign a String from an unsigned short.
const String & | operator= (int i)
| Assign a String from an int.
const String & | operator= (unsigned int ui)
| Assign a String from an unsigned int.
const String & | operator= (long l)
| Assign a String from a long.
const String & | operator= (unsigned long ul)
| Assign a String from an unsigned long.
const String & | operator= (float f)
| Assign a String from a float.
const String & | operator= (double d)
| Assign a String from a double.
Converters
bool | toBool () const
char | toChar () const
| Return the first character of the string.
unsigned char | toUnsignedChar () const
| Return the first character of the string converted to an unsigned char.
short | toShort () const
unsigned short | toUnsignedShort () const
int | toInt () const
unsigned int | toUnsignedInt () const
long | toLong () const
unsigned long | toUnsignedLong () const
float | toFloat () const
double | toDouble () const
Case Conversion
void | toLower (Index from=0, Size len=EndPos)
void | toUpper (Index from=0, Size len=EndPos)
Substring Definition
Substring | getSubstring (Index from=0, Size len=EndPos) const
Substring | operator() (Index from, Size len=EndPos) const
Substring | before (const String &s, Index from=0) const
Substring | through (const String &s, Index from=0) const
Substring | from (const String &s, Index from=0) const
Substring | after (const String &s, Index from=0) const
AWK style field operations
Size | countFields (const char *delimiters=CHARACTER_CLASS__WHITESPACE) const
Size | countFieldsQuoted (const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES) const
String | getField (Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index *from=0) const
String | getFieldQuoted (Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index *from=0) const
Size | split (String string_array[], Size array_size, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
Size | split (std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
Size | splitQuoted (std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index from=0) const
BASIC style string operations
String & | trimLeft (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
String & | trimRight (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
String & | trim (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
String | trim (const char *trimmed=CHARACTER_CLASS__WHITESPACE) const
String & | truncate (Size size)
| Truncate the string to length size.
Substring | left (Size len) const
| Return a substring containing the len leftmost characters of the string.
Substring | right (Size len) const
| Return a substring containing the len rightmost characters of the string.
Substring | instr (const String &pattern, Index from=0) const
Base64 String methods
String | encodeBase64 ()
| Convert a string to a base 64 string.
String | decodeBase64 ()
Debugging and Diagnostics
bool | isValid () const
void | dump (std::ostream &s=std::cout, Size depth=0) const
Iterators
iterator | begin () BALL_NOEXCEPT
const_iterator | begin () const BALL_NOEXCEPT
iterator | end () BALL_NOEXCEPT
const_iterator | end () const BALL_NOEXCEPT
reverse_iterator | rbegin () BALL_NOEXCEPT
const_reverse_iterator | rbegin () const BALL_NOEXCEPT
reverse_iterator | rend () BALL_NOEXCEPT
const_reverse_iterator | rend () const BALL_NOEXCEPT
const_iterator | cbegin () const BALL_NOEXCEPT
const_iterator | cend () const BALL_NOEXCEPT
const_reverse_iterator | crbegin () const BALL_NOEXCEPT
const_reverse_iterator | crend () const BALL_NOEXCEPT
Capacity
size_t | size () const BALL_NOEXCEPT
size_t | length () const BALL_NOEXCEPT
size_t | max_size () const BALL_NOEXCEPT
void | resize (size_t n)
void | resize (size_t n, char c)
size_t | capacity () const BALL_NOEXCEPT
void | reserve (size_t n=0)
void | clear () BALL_NOEXCEPT
bool | empty () const BALL_NOEXCEPT
void | shrink_to_fit ()
Element Access
char & | operator[] (size_t pos)
const char & | operator[] (size_t pos) const
char & | at (size_t pos)
const char & | at (size_t pos) const
char & | front ()
const char & | front () const
char & | back ()
const char & | back () const
Modifiers
String & | operator+= (const String &str)
String & | operator+= (const string &str)
String & | operator+= (const char *s)
String & | operator+= (char c)
String & | operator+= (std::initializer_list< char > il)
String & | append (const String &str)
String & | append (const string &str)
String & | append (const string &str, size_t subpos, size_t sublen)
String & | append (const char *s)
String & | append (const char *s, size_t n)
String & | append (size_t n, char c)
template<class InputIterator>
String & | append (InputIterator first, InputIterator last)
String & | append (std::initializer_list< char > li)
void | push_back (char c)
String & | assign (const String &str)
String & | assign (const string &str)
String & | assign (const string &str, size_t subpos, size_t sublen)
String & | assign (const char *s)
String & | assign (const char *s, size_t n)
String & | assign (size_t n, char c)
template<class InputIterator>
String & | assign (InputIterator first, InputIterator last)
String & | assign (std::initializer_list< char > li)
String & | assign (string &&str) BALL_NOEXCEPT
String & | insert (size_t pos, const string &str)
String & | insert (size_t pos, const string &str, size_t subpos, size_t sublen)
String & | insert (size_t pos, const char *s)
String & | insert (size_t pos, const char *s, size_t n)
String & | insert (size_t pos, size_t n, char c)
void | insert (iterator p, size_t n, char c)
iterator | insert (iterator p, char c)
template<class InputIterator>
iterator | insert (iterator p, InputIterator first, InputIterator last)
String & | erase (size_t pos=0, size_t len=npos)
iterator | erase (iterator p)
iterator | erase (iterator first, iterator last)
String & | replace (size_t pos, size_t len, const string &str)
String & | replace (size_t pos, size_t len, const string &str, size_t subpos, size_t sublen)
String & | replace (size_t pos, size_t len, const char *s)
String & | replace (size_t pos, size_t len, const char *s, size_t n)
String & | replace (size_t pos, size_t len, size_t n, char c)
String & | replace (iterator i1, iterator i2, const string &str)
String & | replace (iterator i1, iterator i2, const char *s)
String & | replace (iterator i1, iterator i2, const char *s, size_t n)
String & | replace (iterator i1, iterator i2, size_t n, char c)
template<class InputIterator>
String & | replace (iterator i1, iterator i2, InputIterator first, InputIterator last)
void | swap (string &str)
void | pop_back ()

## Static Public Member Functions

Compare mode-related methods.
All string comparisons can be made case-sensitive or case insensitive. The behavior can be toggled globally for all strings.
static void | setCompareMode (CompareMode compare_mode)
| Set the compareison mode for all string comparisons.
static CompareMode | getCompareMode ()
| Return the current comparison mode.

## Static Public Attributes

Predefined character classes
There exist several predefined character classes, that may be used in several functions (e.g. trim methods) to represent a set of characters.
static const char * | CHARACTER_CLASS__ASCII_ALPHA
| Character class containing all letters (lower and upper case).
static const char * | CHARACTER_CLASS__ASCII_ALPHANUMERIC
| Character class containing all letters and digits.
static const char * | CHARACTER_CLASS__ASCII_LOWER
| Character class containing all lower case letters.
static const char * | CHARACTER_CLASS__ASCII_UPPER
| Character class containing all upper case letters.
static const char * | CHARACTER_CLASS__ASCII_NUMERIC
| Character class containing the digits from 0 to 9.
static const char * | CHARACTER_CLASS__ASCII_FLOAT
| Character class containing the digits from 0 to 9 and a dot.
static const char * | CHARACTER_CLASS__WHITESPACE
static const char * | CHARACTER_CLASS__QUOTES

## Friends

class | Substring

## Enums and Constants

enum | CompareMode { CASE_SENSITIVE = 0 , CASE_INSENSITIVE = 1 }
static const Size | EndPos
static const size_t | npos = -1

## Stream Operations

typedef string::value_type | valuetype
typedef string::traits_type | traits_type
typedef string::allocator_type | allocator_type
typedef string::reference | reference
typedef string::const_reference | const_reference
typedef string::pointer | pointer
typedef string::const_pointer | const_pointer
typedef string::iterator | iterator
typedef string::const_iterator | const_iterator
typedef string::reverse_iterator | reverse_iterator
typedef string::const_reverse_iterator | const_reverse_iterator
typedef string::difference_type | difference_type
typedef string::size_type | size_type
static const String | EMPTY
| Constant empty string.
std::istream & | getline (std::istream &s=std::cin, char delimiter='\n')

## String Operations

BALL_EXPORT friend String | operator+ (const String &s1, const string &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const string &s1, const String &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const String &s1, const String &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const String &s1, const char *char_ptr)
| Concatenates a string and a C type string.
BALL_EXPORT friend String | operator+ (const char *char_ptr, const String &s)
| Concatenates a C type string and a string.
BALL_EXPORT friend String | operator+ (const String &s, char c)
| Concatenates a string and a character.
BALL_EXPORT friend String | operator+ (char c, const String &s)
| Concatenates a character and a string.
BALL_EXPORT friend String | operator+ (String &&s1, const string &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (String &&s1, const String &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (String &&s1, String &&s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const String &s1, string &&s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (string &&s1, const String &s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const string &s1, String &&s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (const String &s1, String &&s2)
| Concatenates two strings.
BALL_EXPORT friend String | operator+ (String &&s1, const char *char_ptr)
| Concatenates a string and a C type string.
BALL_EXPORT friend String | operator+ (const char *char_ptr, String &&s)
| Concatenates a C type string and a string.
BALL_EXPORT friend String | operator+ (String &&s, char c)
| Concatenates a string and a character.
BALL_EXPORT friend String | operator+ (char c, String &&s)
| Concatenates a character and a string.
void | swap (String &s)
| Swaps the contents with another String.
String & | reverse (Index from=0, Size len=EndPos)
Size | substitute (const String &to_replace, const String &replacing)
void | substituteAll (const String &to_replace, const String &replacing)
const char * | c_str () const BALL_NOEXCEPT
const char * | data () const BALL_NOEXCEPT
allocator_type | get_allocator () const BALL_NOEXCEPT
size_t | copy (char *s, size_t len, size_t pos=0) const
size_t | find (const string &str, size_t pos=0) const BALL_NOEXCEPT
size_t | find (const char *s, size_t pos=0) const
size_t | find (const char *s, size_t pos, size_t n) const
size_t | find (char c, size_t pos=0) const BALL_NOEXCEPT
size_t | rfind (const string &str, size_t pos=npos) const BALL_NOEXCEPT
size_t | rfind (const char *s, size_t pos=npos) const
size_t | rfind (const char *s, size_t pos, size_t n) const
size_t | rfind (char c, size_t pos=npos) const BALL_NOEXCEPT
size_t | find_first_of (const string &str, size_t pos=0) const BALL_NOEXCEPT
size_t | find_first_of (const char *s, size_t pos=0) const
size_t | find_first_of (const char *s, size_t pos, size_t n) const
size_t | find_first_of (char c, size_t pos=0) const BALL_NOEXCEPT
size_t | find_last_of (const string &str, size_t pos=npos) const BALL_NOEXCEPT
size_t | find_last_of (const char *s, size_t pos=npos) const
size_t | find_last_of (const char *s, size_t pos, size_t n) const
size_t | find_last_of (char c, size_t pos=npos) const BALL_NOEXCEPT
size_t | find_first_not_of (const string &str, size_t pos=0) const BALL_NOEXCEPT
size_t | find_first_not_of (const char *s, size_t pos=0) const
size_t | find_first_not_of (const char *s, size_t pos, size_t n) const
size_t | find_first_not_of (char c, size_t pos=0) const BALL_NOEXCEPT
size_t | find_last_not_of (const string &str, size_t pos=npos) const BALL_NOEXCEPT
size_t | find_last_not_of (const char *s, size_t pos=npos) const
size_t | find_last_not_of (const char *s, size_t pos, size_t n) const
size_t | find_last_not_of (char c, size_t pos=npos) const BALL_NOEXCEPT
string | substr (size_t pos=0, size_t len=npos) const
int | compare (const string &str) const BALL_NOEXCEPT
int | compare (size_t pos, size_t len, const string &str) const
int | compare (size_t pos, size_t len, const string &str, size_t subpos, size_t sublen) const
int | compare (size_t pos, size_t len, const char *s) const
int | compare (size_t pos, size_t len, const char *s, size_t n) const
void | validateIndex_ (Index &index) const
void | validateRange_ (Index &from, Size &len) const
static void | validateCharPtrRange_ (Index &from, Size &len, const char *char_ptr)
static void | valudateCharPtrIndex_ (Index &index)

## Comparators

BALL_EXPORT friend bool | operator== (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator!= (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator< (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator<= (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator> (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator>= (const String &s1, const String &s2)
BALL_EXPORT friend bool | operator== (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator!= (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator< (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator<= (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator> (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator>= (const char *char_ptr, const String &string)
BALL_EXPORT friend bool | operator== (char c, const String &string)
BALL_EXPORT friend bool | operator!= (char c, const String &string)
BALL_EXPORT friend bool | operator< (char c, const String &string)
BALL_EXPORT friend bool | operator<= (char c, const String &string)
BALL_EXPORT friend bool | operator> (char c, const String &string)
bool | operator>= (char c, const String &string)
int | compare (const String &string, Index from=0) const
int | compare (const String &string, Index from, Size len) const
int | compare (const char *char_ptr, Index from=0) const
int | compare (const char *char_ptr, Index from, Size len) const
int | compare (char c, Index from=0) const
bool | operator== (const char *char_ptr) const
bool | operator!= (const char *char_ptr) const
bool | operator< (const char *char_ptr) const
bool | operator<= (const char *char_ptr) const
bool | operator> (const char *char_ptr) const
bool | operator>= (const char *char_ptr) const
bool | operator== (char c) const
bool | operator!= (char c) const
bool | operator< (char c) const
bool | operator<= (char c) const
bool | operator> (char c) const
bool | operator>= (char c) const

## Predicates

bool | has (char c) const
| True, if the string contains character c.
bool | hasSubstring (const String &s, Index from=0) const
| True, if the string contains the substring s after index from.
bool | hasPrefix (const String &s) const
| True, if the string starts with s.
bool | hasSuffix (const String &s) const
| True, if the string ends with s.
bool | isEmpty () const
| True, if the string has size 0.
bool | isAlpha () const
bool | isAlnum () const
bool | isDigit () const
bool | isFloat () const
bool | isSpace () const
bool | isWhitespace () const
static bool | isAlpha (char c)
| True, if the character is a letter (any case).
static bool | isAlnum (char c)
| True, if the character is a letter or a digit.
static bool | isDigit (char c)
| True, if the character is a digit.
static bool | isSpace (char c)
| True, if the character is a space.
static bool | isWhitespace (char c)

## Detailed Description

Extended String class.

Definition at line 56 of file string.h.

## Member Typedef Documentation

## allocator_type

typedef string::allocator_type BALL::String::allocator_type

Definition at line 1015 of file string.h.

## const_iterator

typedef string::const_iterator BALL::String::const_iterator

Definition at line 1021 of file string.h.

## const_pointer

typedef string::const_pointer BALL::String::const_pointer

Definition at line 1019 of file string.h.

## const_reference

typedef string::const_reference BALL::String::const_reference

Definition at line 1017 of file string.h.

## const_reverse_iterator

typedef string::const_reverse_iterator BALL::String::const_reverse_iterator

Definition at line 1023 of file string.h.

## difference_type

typedef string::difference_type BALL::String::difference_type

Definition at line 1024 of file string.h.

## iterator

typedef string::iterator BALL::String::iterator

Definition at line 1020 of file string.h.

## pointer

typedef string::pointer BALL::String::pointer

Definition at line 1018 of file string.h.

## reference

typedef string::reference BALL::String::reference

Definition at line 1016 of file string.h.

## reverse_iterator

typedef string::reverse_iterator BALL::String::reverse_iterator

Definition at line 1022 of file string.h.

## size_type

typedef string::size_type BALL::String::size_type

Definition at line 1025 of file string.h.

## traits_type

typedef string::traits_type BALL::String::traits_type

Definition at line 1014 of file string.h.

## valuetype

typedef string::value_type BALL::String::valuetype

@ std::string compatibility layer name typedefs

Definition at line 1013 of file string.h.

## Member Enumeration Documentation

## CompareMode

enum BALL::String::CompareMode

Constants to set the compare mode. Use one of these constants to set the mode you need. These modes affect all compare methods. As these methods are also used in the implementation of comparison operators, all comparison operations will get affected from a change.

  You may change the comparison mode by invoking setCompareMode.

Enumerator
CASE_SENSITIVE | Constant to set to case sensitive comparisons (default).
CASE_INSENSITIVE | Constant to set to case insensitive comparisons.

Definition at line 80 of file string.h.

## Constructor & Destructor Documentation

## String() [1/21]

BALL::String::String | ( |  | ) |

Default Constructor.

## String() [2/21]

BALL::String::String | ( | const string & | string | ) |

STL string copy constructor.

## String() [3/21]

BALL::String::String | ( | const String & | s | ) |

Copy constructor.

## String() [4/21]

BALL::String::String | ( | String && | s | ) |

Move constructor.

## String() [5/21]

BALL::String::String | ( | string && | s | ) |

Move constructor for STL string.

## String() [6/21]

BALL::String::String | ( | const QString & | string | ) |

explicit

QString copy constructor.

## String() [7/21]

BALL::String::String | ( | const QByteArray & | string | ) |

explicit

QByteArray copy constructor.

## String() [8/21]

BALL::String::String | ( | const String & | s,
|  | Index | from,
|  | Size | len = EndPos )

Creates a new string from a given range of another string.

See also
  String:Indices

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## String() [9/21]

BALL::String::String | ( | const char * | char_ptr,
|  | Index | from = 0,
|  | Size | len = EndPos )

Creates a new string from a C type string. The new string contains the contents of s until it has reached a length of len or contains a zero character (whichever comes first). Default value for len is EndPos, meaning as long as possible.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()
  Exception::NullPointer | if char_ptr == NULL

## String() [10/21]

BALL::String::String | ( | Size | buffer_size,
|  | const char * | format,
|  |  | ... )

Creates a string using sprintf. This constructor creates a new string and sets its content to the result of a call to sprintf using format as a format string and all additional parameters as arguments.

  The result of the sprintf call is intermediately written to a buffer of a maximum size of buffer_size characters, so choose an appropriate size for this variables.

Exceptions

  IndexUnderflow,if | the buffer size specified is not larger than 0
  NullPointer,if | format == 0

## String() [11/21]

BALL::String::String | ( | std::stringstream & | s | ) |

Create a new string from the contents of a stringstream. The contents of the stringstream are not modified, i.e. successive construction of multiple strings from the same stringstream object leads to identical copies.

## String() [12/21]

BALL::String::String | ( | const char | c,
|  | Size | len = 1 )

Creates a new string from len copies of c.

## String() [13/21]

BALL::String::String | ( | const unsigned char | uc | ) |

Creates a string just containing an unsigned character.

## String() [14/21]

BALL::String::String | ( | short | s | ) |

Construct a String from a short.

## String() [15/21]

BALL::String::String | ( | unsigned short | us | ) |

Construct a String from an unsigned short.

## String() [16/21]

BALL::String::String | ( | int | i | ) |

Construct a String from an int.

## String() [17/21]

BALL::String::String | ( | unsigned int | ui | ) |

Construct a String from an unsigned int.

## String() [18/21]

BALL::String::String | ( | long | l | ) |

Construct a String from a long.

## String() [19/21]

BALL::String::String | ( | unsigned long |  | ) |

Construct a String from an unsigned long.

## String() [20/21]

BALL::String::String | ( | float | f | ) |

Construct a String from a float value.

## String() [21/21]

BALL::String::String | ( | double | d | ) |

Construct a String from a double value.

## ~String()

virtual BALL::String::~String | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## after()

Substring BALL::String::after | ( | const String & | s,
|  | Index | from = 0 ) const

Return a substring containing the string after the first occurence of s.

## append() [1/8]

String & BALL::String::append | ( | const char * | s | ) |

## append() [2/8]

String & BALL::String::append | ( | const char * | s,
|  | size_t | n )

## append() [3/8]

String & BALL::String::append | ( | const String & | str | ) |

## append() [4/8]

String & BALL::String::append | ( | const string & | str | ) |

## append() [5/8]

String & BALL::String::append | ( | const string & | str,
|  | size_t | subpos,
|  | size_t | sublen )

## append() [6/8]

template<class InputIterator>

String & BALL::String::append | ( | InputIterator | first,
|  | InputIterator | last )

## append() [7/8]

String & BALL::String::append | ( | size_t | n,
|  | char | c )

## append() [8/8]

String & BALL::String::append | ( | std::initializer_list< char > | li | ) |

## assign() [1/9]

String & BALL::String::assign | ( | const char * | s | ) |

## assign() [2/9]

String & BALL::String::assign | ( | const char * | s,
|  | size_t | n )

## assign() [3/9]

String & BALL::String::assign | ( | const String & | str | ) |

## assign() [4/9]

String & BALL::String::assign | ( | const string & | str | ) |

## assign() [5/9]

String & BALL::String::assign | ( | const string & | str,
|  | size_t | subpos,
|  | size_t | sublen )

## assign() [6/9]

template<class InputIterator>

String & BALL::String::assign | ( | InputIterator | first,
|  | InputIterator | last )

## assign() [7/9]

String & BALL::String::assign | ( | size_t | n,
|  | char | c )

## assign() [8/9]

String & BALL::String::assign | ( | std::initializer_list< char > | li | ) |

## assign() [9/9]

String & BALL::String::assign | ( | string && | str | ) |

## at() [1/2]

char & BALL::String::at | ( | size_t | pos | ) |

## at() [2/2]

const char & BALL::String::at | ( | size_t | pos | ) | const

## back() [1/2]

char & BALL::String::back | ( |  | ) |

## back() [2/2]

const char & BALL::String::back | ( |  | ) | const

## before()

Substring BALL::String::before | ( | const String & | s,
|  | Index | from = 0 ) const

Return a substring containing the string before the first occurence of s

## begin() [1/2]

iterator BALL::String::begin | ( |  | ) |

## begin() [2/2]

const_iterator BALL::String::begin | ( |  | ) | const

## c_str()

const char * BALL::String::c_str | ( |  | ) | const

## capacity()

size_t BALL::String::capacity | ( |  | ) | const

## cbegin()

const_iterator BALL::String::cbegin | ( |  | ) | const

## cend()

const_iterator BALL::String::cend | ( |  | ) | const

## clear()

void BALL::String::clear | ( |  | ) |

## compare() [1/10]

int BALL::String::compare | ( | char | c,
|  | Index | from = 0 ) const

compare to character

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## compare() [2/10]

int BALL::String::compare | ( | const char * | char_ptr,
|  | Index | from,
|  | Size | len ) const

compare to c-style string.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()
  Exception::NullPointer | if char_ptr == NULL

## compare() [3/10]

int BALL::String::compare | ( | const char * | char_ptr,
|  | Index | from = 0 ) const

compare to c-style string.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()
  Exception::NullPointer | if char_ptr == NULL

## compare() [4/10]

int BALL::String::compare | ( | const string & | str | ) | const

## compare() [5/10]

int BALL::String::compare | ( | const String & | string,
|  | Index | from,
|  | Size | len ) const

compare to a string.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## compare() [6/10]

int BALL::String::compare | ( | const String & | string,
|  | Index | from = 0 ) const

compare to a string.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## compare() [7/10]

int BALL::String::compare | ( | size_t | pos,
|  | size_t | len,
|  | const char * | s ) const

## compare() [8/10]

int BALL::String::compare | ( | size_t | pos,
|  | size_t | len,
|  | const char * | s,
|  | size_t | n ) const

## compare() [9/10]

int BALL::String::compare | ( | size_t | pos,
|  | size_t | len,
|  | const string & | str ) const

## compare() [10/10]

int BALL::String::compare | ( | size_t | pos,
|  | size_t | len,
|  | const string & | str,
|  | size_t | subpos,
|  | size_t | sublen ) const

## copy()

size_t BALL::String::copy | ( | char * | s,
|  | size_t | len,
|  | size_t | pos = 0 ) const

## countFields()

Size BALL::String::countFields | ( | const char * | delimiters = CHARACTER_CLASS__WHITESPACE | ) | const

Count the fields that are separated by a defined set of delimiters

Exceptions

  Exception::NullPointer | if delimiters == NULL

## countFieldsQuoted()

Size BALL::String::countFieldsQuoted | ( | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | const char * | quotes = CHARACTER_CLASS__QUOTES ) const

Count the fields and respect quote characters.

Exceptions

  Exception::NullPointer | if delimiters == NULL or quotes == NULL

## crbegin()

const_reverse_iterator BALL::String::crbegin | ( |  | ) | const

## create()

virtual void * BALL::String::create | ( | bool | = true,
|  | bool | empty = false ) const

virtual

## crend()

const_reverse_iterator BALL::String::crend | ( |  | ) | const

## data()

const char * BALL::String::data | ( |  | ) | const

## decodeBase64()

String BALL::String::decodeBase64 | ( |  | ) |

Decode a base 64 string. Return an empty string, if base64 string is not right encoded.

## destroy()

void BALL::String::destroy | ( |  | ) |

Clear the string (reset to the empty string).

## dump()

void BALL::String::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

## empty()

bool BALL::String::empty | ( |  | ) | const

## encodeBase64()

String BALL::String::encodeBase64 | ( |  | ) |

Convert a string to a base 64 string.

## end() [1/2]

iterator BALL::String::end | ( |  | ) |

## end() [2/2]

const_iterator BALL::String::end | ( |  | ) | const

## erase() [1/3]

iterator BALL::String::erase | ( | iterator | first,
|  | iterator | last )

## erase() [2/3]

iterator BALL::String::erase | ( | iterator | p | ) |

## erase() [3/3]

String & BALL::String::erase | ( | size_t | pos = 0,
|  | size_t | len = npos )

## find() [1/4]

size_t BALL::String::find | ( | char | c,
|  | size_t | pos = 0 ) const

## find() [2/4]

size_t BALL::String::find | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## find() [3/4]

size_t BALL::String::find | ( | const char * | s,
|  | size_t | pos = 0 ) const

## find() [4/4]

size_t BALL::String::find | ( | const string & | str,
|  | size_t | pos = 0 ) const

## find_first_not_of() [1/4]

size_t BALL::String::find_first_not_of | ( | char | c,
|  | size_t | pos = 0 ) const

## find_first_not_of() [2/4]

size_t BALL::String::find_first_not_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## find_first_not_of() [3/4]

size_t BALL::String::find_first_not_of | ( | const char * | s,
|  | size_t | pos = 0 ) const

## find_first_not_of() [4/4]

size_t BALL::String::find_first_not_of | ( | const string & | str,
|  | size_t | pos = 0 ) const

## find_first_of() [1/4]

size_t BALL::String::find_first_of | ( | char | c,
|  | size_t | pos = 0 ) const

## find_first_of() [2/4]

size_t BALL::String::find_first_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## find_first_of() [3/4]

size_t BALL::String::find_first_of | ( | const char * | s,
|  | size_t | pos = 0 ) const

## find_first_of() [4/4]

size_t BALL::String::find_first_of | ( | const string & | str,
|  | size_t | pos = 0 ) const

## find_last_not_of() [1/4]

size_t BALL::String::find_last_not_of | ( | char | c,
|  | size_t | pos = npos ) const

## find_last_not_of() [2/4]

size_t BALL::String::find_last_not_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## find_last_not_of() [3/4]

size_t BALL::String::find_last_not_of | ( | const char * | s,
|  | size_t | pos = npos ) const

## find_last_not_of() [4/4]

size_t BALL::String::find_last_not_of | ( | const string & | str,
|  | size_t | pos = npos ) const

## find_last_of() [1/4]

size_t BALL::String::find_last_of | ( | char | c,
|  | size_t | pos = npos ) const

## find_last_of() [2/4]

size_t BALL::String::find_last_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## find_last_of() [3/4]

size_t BALL::String::find_last_of | ( | const char * | s,
|  | size_t | pos = npos ) const

## find_last_of() [4/4]

size_t BALL::String::find_last_of | ( | const string & | str,
|  | size_t | pos = npos ) const

## from()

Substring BALL::String::from | ( | const String & | s,
|  | Index | from = 0 ) const

Return a substring containing the string from the first occurence of s on

## front() [1/2]

char & BALL::String::front | ( |  | ) |

## front() [2/2]

const char & BALL::String::front | ( |  | ) | const

## get()

void BALL::String::get | ( | char * | char_ptr,
|  | Index | from = 0,
|  | Size | len = EndPos ) const

Assign to a C type string The resulting string contains the contents of this until it has reached a length of len or contains a zero character (whichever comes first). Default value for len is EndPos, meaning as long as possible.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()
  Exception::NullPointer | if char_ptr == NULL

## get_allocator()

allocator_type BALL::String::get_allocator | ( |  | ) | const

## getCompareMode()

CompareMode BALL::String::getCompareMode | ( |  | ) |

static

Return the current comparison mode.

## getField()

String BALL::String::getField | ( | Index | index,
|  | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | Index * | from = 0 ) const

Return a given field as a substring

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::NullPointer | if delimiters == NULL

## getFieldQuoted()

String BALL::String::getFieldQuoted | ( | Index | index,
|  | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | const char * | quotes = CHARACTER_CLASS__QUOTES,
|  | Index * | from = 0 ) const

Return a given field and respect quote characters.

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::NullPointer | if delimiters == NULL

## getline()

std::istream & BALL::String::getline | ( | std::istream & | s = std::cin,
|  | char | delimiter = '\n' )

## getSubstring()

Substring BALL::String::getSubstring | ( | Index | from = 0,
|  | Size | len = EndPos ) const

Return a substring

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## has()

bool BALL::String::has | ( | char | c | ) | const

True, if the string contains character c.

## hasPrefix()

bool BALL::String::hasPrefix | ( | const String & | s | ) | const

True, if the string starts with s.

## hasSubstring()

bool BALL::String::hasSubstring | ( | const String & | s,
|  | Index | from = 0 ) const

True, if the string contains the substring s after index from.

## hasSuffix()

bool BALL::String::hasSuffix | ( | const String & | s | ) | const

True, if the string ends with s.

## insert() [1/8]

iterator BALL::String::insert | ( | iterator | p,
|  | char | c )

## insert() [2/8]

template<class InputIterator>

iterator BALL::String::insert | ( | iterator | p,
|  | InputIterator | first,
|  | InputIterator | last )

## insert() [3/8]

void BALL::String::insert | ( | iterator | p,
|  | size_t | n,
|  | char | c )

## insert() [4/8]

String & BALL::String::insert | ( | size_t | pos,
|  | const char * | s )

## insert() [5/8]

String & BALL::String::insert | ( | size_t | pos,
|  | const char * | s,
|  | size_t | n )

## insert() [6/8]

String & BALL::String::insert | ( | size_t | pos,
|  | const string & | str )

## insert() [7/8]

String & BALL::String::insert | ( | size_t | pos,
|  | const string & | str,
|  | size_t | subpos,
|  | size_t | sublen )

## insert() [8/8]

String & BALL::String::insert | ( | size_t | pos,
|  | size_t | n,
|  | char | c )

## instr()

Substring BALL::String::instr | ( | const String & | pattern,
|  | Index | from = 0 ) const

Return a substring containing the first occurence of pattern in the string. If the pattern is not contained in the string, an empty Substring is returned. The search for the pattern may also start from an index different from zero, allowing incremental search.

Returns
  Substring containing the search pattern, empty if not found

Parameters

  pattern | the search pattern
  from | the index in the string to start the search from

## isAlnum() [1/2]

bool BALL::String::isAlnum | ( |  | ) | const

True, if the string only contains letters and digits. It returns also true, if called for an empty string.

## isAlnum() [2/2]

bool BALL::String::isAlnum | ( | char | c | ) |

static

True, if the character is a letter or a digit.

## isAlpha() [1/2]

bool BALL::String::isAlpha | ( |  | ) | const

True, if the string only contains letters (any case). It returns also true, if called for an empty string.

## isAlpha() [2/2]

bool BALL::String::isAlpha | ( | char | c | ) |

static

True, if the character is a letter (any case).

## isDigit() [1/2]

bool BALL::String::isDigit | ( |  | ) | const

True, if the string only contains digits. It returns also true, if called for an empty string.

## isDigit() [2/2]

bool BALL::String::isDigit | ( | char | c | ) |

static

True, if the character is a digit.

## isEmpty()

bool BALL::String::isEmpty | ( |  | ) | const

True, if the string has size 0.

## isFloat()

bool BALL::String::isFloat | ( |  | ) | const

True, if the string is a floating number. (It contains only numbers and maybe a dot). It returns also true, if called for an empty string.

## isSpace() [1/2]

bool BALL::String::isSpace | ( |  | ) | const

True, if the string only contains spaces. It returns also true, if called for an empty string.

## isSpace() [2/2]

bool BALL::String::isSpace | ( | char | c | ) |

static

True, if the character is a space.

## isValid()

bool BALL::String::isValid | ( |  | ) | const

## isWhitespace() [1/2]

bool BALL::String::isWhitespace | ( |  | ) | const

True, if the string only contains whitespace characters. Whitespaces are defined in CHARACTER_CLASS__WHITESPACE. It returns also true, if called for an empty string.

## isWhitespace() [2/2]

bool BALL::String::isWhitespace | ( | char | c | ) |

static

True, if the character is any whitespace character. Whitespaces are defined in CHARACTER_CLASS__WHITESPACE

## left()

Substring BALL::String::left | ( | Size | len | ) | const

Return a substring containing the len leftmost characters of the string.

## length()

size_t BALL::String::length | ( |  | ) | const

## max_size()

size_t BALL::String::max_size | ( |  | ) | const

## operator string &()

BALL::String::operator string & | ( |  | ) |

Cast the String to a std::string reference.

## operator string const &()

BALL::String::operator string const & | ( |  | ) | const

Cast the String to a std::string reference, const version.

## operator!=() [1/2]

bool BALL::String::operator!= | ( | char | c | ) | const

## operator!=() [2/2]

bool BALL::String::operator!= | ( | const char * | char_ptr | ) | const

Inequality operator.

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator()()

Substring BALL::String::operator() | ( | Index | from,
|  | Size | len = EndPos ) const

Return a substring

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## operator+=() [1/5]

String & BALL::String::operator+= | ( | char | c | ) |

## operator+=() [2/5]

String & BALL::String::operator+= | ( | const char * | s | ) |

## operator+=() [3/5]

String & BALL::String::operator+= | ( | const String & | str | ) |

## operator+=() [4/5]

String & BALL::String::operator+= | ( | const string & | str | ) |

## operator+=() [5/5]

String & BALL::String::operator+= | ( | std::initializer_list< char > | il | ) |

## operator<() [1/2]

bool BALL::String::operator< | ( | char | c | ) | const

## operator<() [2/2]

bool BALL::String::operator< | ( | const char * | char_ptr | ) | const

Less than comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator<=() [1/2]

bool BALL::String::operator<= | ( | char | c | ) | const

## operator<=() [2/2]

bool BALL::String::operator<= | ( | const char * | char_ptr | ) | const

Less than or equal comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator=() [1/15]

const String & BALL::String::operator= | ( | char | c | ) |

Assign a String from a single char.

## operator=() [2/15]

const String & BALL::String::operator= | ( | const char * | pc | ) |

Assign a String from a C type string

Exceptions

  Exception::NullPointer | if pc == NULL

## operator=() [3/15]

const String & BALL::String::operator= | ( | const String & | s | ) |

Assign a String from another String.

## operator=() [4/15]

const String & BALL::String::operator= | ( | double | d | ) |

Assign a String from a double.

## operator=() [5/15]

const String & BALL::String::operator= | ( | float | f | ) |

Assign a String from a float.

## operator=() [6/15]

const String & BALL::String::operator= | ( | int | i | ) |

Assign a String from an int.

## operator=() [7/15]

const String & BALL::String::operator= | ( | long | l | ) |

Assign a String from a long.

## operator=() [8/15]

const String & BALL::String::operator= | ( | short | s | ) |

Assign a String from a short.

## operator=() [9/15]

const String & BALL::String::operator= | ( | std::stringstream & | s | ) |

Assign a string from a stringstream. The contents of the stringstream object are not modified.

## operator=() [10/15]

String & BALL::String::operator= | ( | String && | s | ) |

Move assigment operator.

## operator=() [11/15]

String & BALL::String::operator= | ( | string && | s | ) |

Move assignment operator for STL string.

## operator=() [12/15]

const String & BALL::String::operator= | ( | unsigned char | uc | ) |

Assign a String from an unsigned char.

## operator=() [13/15]

const String & BALL::String::operator= | ( | unsigned int | ui | ) |

Assign a String from an unsigned int.

## operator=() [14/15]

const String & BALL::String::operator= | ( | unsigned long | ul | ) |

Assign a String from an unsigned long.

## operator=() [15/15]

const String & BALL::String::operator= | ( | unsigned short | us | ) |

Assign a String from an unsigned short.

## operator==() [1/2]

bool BALL::String::operator== | ( | char | c | ) | const

## operator==() [2/2]

bool BALL::String::operator== | ( | const char * | char_ptr | ) | const

Equality operator.

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator>() [1/2]

bool BALL::String::operator> | ( | char | c | ) | const

## operator>() [2/2]

bool BALL::String::operator> | ( | const char * | char_ptr | ) | const

Greater than comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator>=() [1/2]

bool BALL::String::operator>= | ( | char | c | ) | const

## operator>=() [2/2]

bool BALL::String::operator>= | ( | const char * | char_ptr | ) | const

Greater than or equal comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator[]() [1/2]

char & BALL::String::operator[] | ( | size_t | pos | ) |

## operator[]() [2/2]

const char & BALL::String::operator[] | ( | size_t | pos | ) | const

## pop_back()

void BALL::String::pop_back | ( |  | ) |

## push_back()

void BALL::String::push_back | ( | char | c | ) |

## rbegin() [1/2]

reverse_iterator BALL::String::rbegin | ( |  | ) |

## rbegin() [2/2]

const_reverse_iterator BALL::String::rbegin | ( |  | ) | const

## rend() [1/2]

reverse_iterator BALL::String::rend | ( |  | ) |

## rend() [2/2]

const_reverse_iterator BALL::String::rend | ( |  | ) | const

## replace() [1/10]

String & BALL::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | const char * | s )

## replace() [2/10]

String & BALL::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | const char * | s,
|  | size_t | n )

## replace() [3/10]

String & BALL::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | const string & | str )

## replace() [4/10]

template<class InputIterator>

String & BALL::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | InputIterator | first,
|  | InputIterator | last )

## replace() [5/10]

String & BALL::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | size_t | n,
|  | char | c )

## replace() [6/10]

String & BALL::String::replace | ( | size_t | pos,
|  | size_t | len,
|  | const char * | s )

## replace() [7/10]

String & BALL::String::replace | ( | size_t | pos,
|  | size_t | len,
|  | const char * | s,
|  | size_t | n )

## replace() [8/10]

String & BALL::String::replace | ( | size_t | pos,
|  | size_t | len,
|  | const string & | str )

## replace() [9/10]

String & BALL::String::replace | ( | size_t | pos,
|  | size_t | len,
|  | const string & | str,
|  | size_t | subpos,
|  | size_t | sublen )

## replace() [10/10]

String & BALL::String::replace | ( | size_t | pos,
|  | size_t | len,
|  | size_t | n,
|  | char | c )

## reserve()

void BALL::String::reserve | ( | size_t | n = 0 | ) |

## resize() [1/2]

void BALL::String::resize | ( | size_t | n | ) |

## resize() [2/2]

void BALL::String::resize | ( | size_t | n,
|  | char | c )

## reverse()

String & BALL::String::reverse | ( | Index | from = 0,
|  | Size | len = EndPos )

Reverses the string. If called without arguments, this method simply reverses the character sequence of the string. By giving arguments for the indices, only a subsequence of the string may be reversed.

Parameters

  from | first index of the sequence to be reversed
  to | last index of the sequence to be reversed

See also
  String:Indices

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()

## rfind() [1/4]

size_t BALL::String::rfind | ( | char | c,
|  | size_t | pos = npos ) const

## rfind() [2/4]

size_t BALL::String::rfind | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n ) const

## rfind() [3/4]

size_t BALL::String::rfind | ( | const char * | s,
|  | size_t | pos = npos ) const

## rfind() [4/4]

size_t BALL::String::rfind | ( | const string & | str,
|  | size_t | pos = npos ) const

## right()

Substring BALL::String::right | ( | Size | len | ) | const

Return a substring containing the len rightmost characters of the string.

## set() [1/15]

void BALL::String::set | ( | char | c,
|  | Size | len = 1 )

Assign a String from the result of repeating c len times.

## set() [2/15]

void BALL::String::set | ( | const char * | char_ptr,
|  | Index | from = 0,
|  | Size | len = EndPos )

Assign a String from a C type string

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from >= size()
  Exception::NullPointer | if char_ptr == NULL

## set() [3/15]

void BALL::String::set | ( | const String & | s | ) |

Assign a string

## set() [4/15]

void BALL::String::set | ( | const String & | string,
|  | Index | from,
|  | Size | len = EndPos )

Assign a String from a range of another string

Exceptions

  Exception::IndexOverflow | if from < 0
  Exception::IndexUnderflow | if from >= size()

## set() [5/15]

void BALL::String::set | ( | double | d | ) |

Assign a String from a double value.

## set() [6/15]

void BALL::String::set | ( | float | f | ) |

Assign a String from a float value.

## set() [7/15]

void BALL::String::set | ( | int | i | ) |

Assign a String from an int.

## set() [8/15]

void BALL::String::set | ( | long | l | ) |

Assign a String from a long.

## set() [9/15]

void BALL::String::set | ( | short | s | ) |

Assign a String from a short.

## set() [10/15]

void BALL::String::set | ( | Size | buffer_size,
|  | const char * | format,
|  |  | ... )

Assign a string to the result of a sprintf call

Exceptions

  Exception::IndexUnderflow,if | the buffer size is zero
  Exception::NullPointer,<tt>format</tt> | is a NULL pointer

## set() [11/15]

void BALL::String::set | ( | std::stringstream & | s | ) |

Assign a String from a stringstream. The contents of the stringstream object are not modified.

## set() [12/15]

void BALL::String::set | ( | unsigned char | uc | ) |

Assign a String from an unsigned char.

## set() [13/15]

void BALL::String::set | ( | unsigned int | ui | ) |

Assign a String from an unsigned int.

## set() [14/15]

void BALL::String::set | ( | unsigned long | ul | ) |

Assign a String from an unsigned long.

## set() [15/15]

void BALL::String::set | ( | unsigned short | us | ) |

Assign a String from an unsigned short.

## setCompareMode()

void BALL::String::setCompareMode | ( | CompareMode | compare_mode | ) |

static

Set the compareison mode for all string comparisons.

## shrink_to_fit()

void BALL::String::shrink_to_fit | ( |  | ) |

## size()

size_t BALL::String::size | ( |  | ) | const

## split() [1/2]

Size BALL::String::split | ( | std::vector< String > & | strings,
|  | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | Index | from = 0 ) const

Split the string into fields and assign these field to a vector of strings. The vector of strings is cleared in any case. Its final size is returned.

Exceptions

  IndexOverflow | if from < 0
  NullPointer | if delimiters == 0

## split() [2/2]

Size BALL::String::split | ( | String | string_array[],
|  | Size | array_size,
|  | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | Index | from = 0 ) const

Split the string into fields and assign these field to an array of strings

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::NullPointer | if delimiters == NULL

## splitQuoted()

Size BALL::String::splitQuoted | ( | std::vector< String > & | strings,
|  | const char * | delimiters = CHARACTER_CLASS__WHITESPACE,
|  | const char * | quotes = CHARACTER_CLASS__QUOTES,
|  | Index | from = 0 ) const

Split the string into fields and respect quote characters. Similar to split , but delimiters that are inside quote characters (default is CHARACTER_CLASS__QUOTES ) are not considered to split the string. The vector of strings is cleared in any case. Its final size is returned.

Exceptions

  IndexOverflow | if from < 0
  NullPointer | if delimiters == 0

## substitute()

Size BALL::String::substitute | ( | const String & | to_replace,
|  | const String & | replacing )

Substitute the first occurence of to_replace by the content of replacing.

Returns
  the first position of the substitution or EndPos if to_replace is not found

## substituteAll()

void BALL::String::substituteAll | ( | const String & | to_replace,
|  | const String & | replacing )

Substitute all occurences of to_replace by the content of replacing.

## substr()

string BALL::String::substr | ( | size_t | pos = 0,
|  | size_t | len = npos ) const

## swap() [1/2]

void BALL::String::swap | ( | String & | s | ) |

Swaps the contents with another String.

## swap() [2/2]

void BALL::String::swap | ( | string & | str | ) |

## through()

Substring BALL::String::through | ( | const String & | s,
|  | Index | from = 0 ) const

Return a substring containing the beginning of the string including the first occurence of s

## toBool()

bool BALL::String::toBool | ( |  | ) | const

Converts the string to a bool value. This method returns false, if the string contains the string false (may be surrounded by whitespaces), or true otherwise.

## toChar()

char BALL::String::toChar | ( |  | ) | const

Return the first character of the string.

## toDouble()

double BALL::String::toDouble | ( |  | ) | const

Convert the string to a double

Exceptions

  Exception::InvalidFormat |

## toFloat()

float BALL::String::toFloat | ( |  | ) | const

Convert the string to a float

Exceptions

  Exception::InvalidFormat |

## toInt()

int BALL::String::toInt | ( |  | ) | const

Convert the string to an int

Exceptions

  Exception::InvalidFormat |

## toLong()

long BALL::String::toLong | ( |  | ) | const

Convert the string to a long

Exceptions

  Exception::InvalidFormat |

## toLower()

void BALL::String::toLower | ( | Index | from = 0,
|  | Size | len = EndPos )

Convert all characters in the given range to lower case

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from || len >= size()

## toShort()

short BALL::String::toShort | ( |  | ) | const

Convert the string to a short

Exceptions

  Exception::InvalidFormat |

## toUnsignedChar()

unsigned char BALL::String::toUnsignedChar | ( |  | ) | const

Return the first character of the string converted to an unsigned char.

## toUnsignedInt()

unsigned int BALL::String::toUnsignedInt | ( |  | ) | const

Convert the string to an unsigned int

Exceptions

  Exception::InvalidFormat |

## toUnsignedLong()

unsigned long BALL::String::toUnsignedLong | ( |  | ) | const

Convert the string to an unsigned long

Exceptions

  Exception::InvalidFormat |

## toUnsignedShort()

unsigned short BALL::String::toUnsignedShort | ( |  | ) | const

Convert the string to an unsigned short

Exceptions

  Exception::InvalidFormat |

## toUpper()

void BALL::String::toUpper | ( | Index | from = 0,
|  | Size | len = EndPos )

Convert all characters in the given range to upper case

Exceptions

  Exception::IndexUnderflow | if from < 0
  Exception::IndexOverflow | if from || len >= size()

## trim() [1/2]

String & BALL::String::trim | ( | const char * | trimmed = CHARACTER_CLASS__WHITESPACE | ) |

Strips all characters in trimmed from both sides of the string. trim calls trimRight(trimmed).trimLeft(trimmed).

## trim() [2/2]

String BALL::String::trim | ( | const char * | trimmed = CHARACTER_CLASS__WHITESPACE | ) | const

Strips all characters in trimmed from both sides of the string. trim calls trimRight(trimmed).trimLeft(trimmed).

## trimLeft()

String & BALL::String::trimLeft | ( | const char * | trimmed = CHARACTER_CLASS__WHITESPACE | ) |

Strips all characters in trimmed from the left of the string. trimLeft stops at the first character encountered that is not in trimmed. Using its default parameter CHARACTER_CLASS__WHITESPACE, it is usually handy to remove blanks from the beginning of a string. Strings consisting of character from trimmed only yield an empty string.

## trimRight()

String & BALL::String::trimRight | ( | const char * | trimmed = CHARACTER_CLASS__WHITESPACE | ) |

Strips all characters in trimmed from the right of the string. trimRight stops at the first character encountered that is not in trimmed. Using its default parameter CHARACTER_CLASS__WHITESPACE, it is usually handy to remove blanks from the end of a string. Strings consisting of character from trimmed only yield an empty string.

## truncate()

String & BALL::String::truncate | ( | Size | size | ) |

Truncate the string to length size.

## validateCharPtrRange_()

void BALL::String::validateCharPtrRange_ | ( | Index & | from,
|  | Size & | len,
|  | const char * | char_ptr )

static protected

## validateIndex_()

void BALL::String::validateIndex_ | ( | Index & | index | ) | const

protected

## validateRange_()

void BALL::String::validateRange_ | ( | Index & | from,
|  | Size & | len ) const

protected

## valudateCharPtrIndex_()

void BALL::String::valudateCharPtrIndex_ | ( | Index & | index | ) |

static protected

## Friends And Related Symbol Documentation

## operator!= [1/3]

BALL_EXPORT friend bool operator!= | ( | char | c,
|  | const String & | string )

friend

## operator!= [2/3]

BALL_EXPORT friend bool operator!= | ( | const char * | char_ptr,
|  | const String & | string )

friend

Inequality operator.

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator!= [3/3]

BALL_EXPORT friend bool operator!= | ( | const String & | s1,
|  | const String & | s2 )

friend

Inequality operator.

## operator+ [1/18]

BALL_EXPORT friend String operator+ | ( | char | c,
|  | const String & | s )

friend

Concatenates a character and a string.

## operator+ [2/18]

BALL_EXPORT friend String operator+ | ( | char | c,
|  | String && | s )

friend

Concatenates a character and a string.

## operator+ [3/18]

BALL_EXPORT friend String operator+ | ( | const char * | char_ptr,
|  | const String & | s )

friend

Concatenates a C type string and a string.

## operator+ [4/18]

BALL_EXPORT friend String operator+ | ( | const char * | char_ptr,
|  | String && | s )

friend

Concatenates a C type string and a string.

## operator+ [5/18]

BALL_EXPORT friend String operator+ | ( | const String & | s,
|  | char | c )

friend

Concatenates a string and a character.

## operator+ [6/18]

BALL_EXPORT friend String operator+ | ( | const String & | s1,
|  | const char * | char_ptr )

friend

Concatenates a string and a C type string.

## operator+ [7/18]

BALL_EXPORT friend String operator+ | ( | const String & | s1,
|  | const String & | s2 )

friend

Concatenates two strings.

## operator+ [8/18]

BALL_EXPORT friend String operator+ | ( | const String & | s1,
|  | const string & | s2 )

friend

Concatenates two strings.

## operator+ [9/18]

BALL_EXPORT friend String operator+ | ( | const string & | s1,
|  | const String & | s2 )

friend

Concatenates two strings.

## operator+ [10/18]

BALL_EXPORT friend String operator+ | ( | const String & | s1,
|  | String && | s2 )

friend

Concatenates two strings.

## operator+ [11/18]

BALL_EXPORT friend String operator+ | ( | const String & | s1,
|  | string && | s2 )

friend

Concatenates two strings.

## operator+ [12/18]

BALL_EXPORT friend String operator+ | ( | const string & | s1,
|  | String && | s2 )

friend

Concatenates two strings.

## operator+ [13/18]

BALL_EXPORT friend String operator+ | ( | String && | s,
|  | char | c )

friend

Concatenates a string and a character.

## operator+ [14/18]

BALL_EXPORT friend String operator+ | ( | String && | s1,
|  | const char * | char_ptr )

friend

Concatenates a string and a C type string.

## operator+ [15/18]

BALL_EXPORT friend String operator+ | ( | String && | s1,
|  | const String & | s2 )

friend

Concatenates two strings.

## operator+ [16/18]

BALL_EXPORT friend String operator+ | ( | String && | s1,
|  | const string & | s2 )

friend

Concatenates two strings.

## operator+ [17/18]

BALL_EXPORT friend String operator+ | ( | string && | s1,
|  | const String & | s2 )

friend

Concatenates two strings.

## operator+ [18/18]

BALL_EXPORT friend String operator+ | ( | String && | s1,
|  | String && | s2 )

friend

Concatenates two strings.

## operator< [1/3]

BALL_EXPORT friend bool operator< | ( | char | c,
|  | const String & | string )

friend

## operator< [2/3]

BALL_EXPORT friend bool operator< | ( | const char * | char_ptr,
|  | const String & | string )

friend

Less than comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator< [3/3]

BALL_EXPORT friend bool operator< | ( | const String & | s1,
|  | const String & | s2 )

friend

Less than comparison

## operator<= [1/3]

BALL_EXPORT friend bool operator<= | ( | char | c,
|  | const String & | string )

friend

## operator<= [2/3]

BALL_EXPORT friend bool operator<= | ( | const char * | char_ptr,
|  | const String & | string )

friend

Less than or equal comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator<= [3/3]

BALL_EXPORT friend bool operator<= | ( | const String & | s1,
|  | const String & | s2 )

friend

Less than or equal comparison

## operator== [1/3]

BALL_EXPORT friend bool operator== | ( | char | c,
|  | const String & | string )

friend

## operator== [2/3]

BALL_EXPORT friend bool operator== | ( | const char * | char_ptr,
|  | const String & | string )

friend

Equality operator.

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator== [3/3]

BALL_EXPORT friend bool operator== | ( | const String & | s1,
|  | const String & | s2 )

friend

Equality operator.

## operator> [1/3]

BALL_EXPORT friend bool operator> | ( | char | c,
|  | const String & | string )

friend

## operator> [2/3]

BALL_EXPORT friend bool operator> | ( | const char * | char_ptr,
|  | const String & | string )

friend

Greater than comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator> [3/3]

BALL_EXPORT friend bool operator> | ( | const String & | s1,
|  | const String & | s2 )

friend

Greater than comparison

## operator>= [1/3]

bool operator>= | ( | char | c,
|  | const String & | string )

friend

## operator>= [2/3]

BALL_EXPORT friend bool operator>= | ( | const char * | char_ptr,
|  | const String & | string )

friend

Greater than or equal comparison

Exceptions

  Exception::NullPointer | if char_ptr == NULL

## operator>= [3/3]

BALL_EXPORT friend bool operator>= | ( | const String & | s1,
|  | const String & | s2 )

friend

Greater than or equal comparison

## Substring

friend class Substring

friend

Definition at line 59 of file string.h.

## Member Data Documentation

## CHARACTER_CLASS__ASCII_ALPHA

const char* BALL::String::CHARACTER_CLASS__ASCII_ALPHA

static

Character class containing all letters (lower and upper case).

Definition at line 109 of file string.h.

## CHARACTER_CLASS__ASCII_ALPHANUMERIC

const char* BALL::String::CHARACTER_CLASS__ASCII_ALPHANUMERIC

static

Character class containing all letters and digits.

Definition at line 112 of file string.h.

## CHARACTER_CLASS__ASCII_FLOAT

const char* BALL::String::CHARACTER_CLASS__ASCII_FLOAT

static

Character class containing the digits from 0 to 9 and a dot.

Definition at line 124 of file string.h.

## CHARACTER_CLASS__ASCII_LOWER

const char* BALL::String::CHARACTER_CLASS__ASCII_LOWER

static

Character class containing all lower case letters.

Definition at line 115 of file string.h.

## CHARACTER_CLASS__ASCII_NUMERIC

const char* BALL::String::CHARACTER_CLASS__ASCII_NUMERIC

static

Character class containing the digits from 0 to 9.

Definition at line 121 of file string.h.

## CHARACTER_CLASS__ASCII_UPPER

const char* BALL::String::CHARACTER_CLASS__ASCII_UPPER

static

Character class containing all upper case letters.

Definition at line 118 of file string.h.

## CHARACTER_CLASS__QUOTES

const char* BALL::String::CHARACTER_CLASS__QUOTES

static

Character class containing double quotes.

Definition at line 141 of file string.h.

## CHARACTER_CLASS__WHITESPACE

const char* BALL::String::CHARACTER_CLASS__WHITESPACE

static

Character class containing all whitespace characters. Whitespace characters are:

- blank " "
- horizontal tab $ "\backslash t" $
- new-line $ "\backslash n" $
- line-feed $ "\backslash r" $
- vertical tab $ "\backslash v" $
- form-feed $ "\backslash f" $

Definition at line 137 of file string.h.

## EMPTY

const String BALL::String::EMPTY

static

Constant empty string.

Definition at line 1004 of file string.h.

## EndPos

const Size BALL::String::EndPos

static

Constant indicating the end of the string. Use this constant instead of string::npos to indicate an invalid position inside the string or the end of the string in those methods requiring indices.

Definition at line 94 of file string.h.

## npos

const size_t BALL::String::npos = -1

static

Constant with a value of the greatest posible value for an element of type size_t.

Definition at line 98 of file string.h.