Biorbd Release_1.13.0
Loading...
Searching...
No Matches
BIORBD_NAMESPACE::utils::String Class Reference

Wrapper around the std::string class with augmented functionality. More...

#include <String.h>

Inheritance diagram for BIORBD_NAMESPACE::utils::String:
BIORBD_NAMESPACE::utils::Equation

Public Member Functions

 String ()
 Construct string.
 String (const char *text)
 Construct string.
 String (const String &text)
 Construct string.
 String (const std::basic_string< char > &text)
 Construct string.
String & operator= (const String &other)
 Allow to use operator=.
String operator+ (size_t val)
 Append an unsigned int to the string.
String operator+ (int val)
 Append an int to the string.
String operator+ (double val)
 Append a double to the string.
String operator+ (const char *text)
 Append a char to the string.
String operator() (size_t idx) const
 Get a specific character in the string.
String operator() (size_t startIdx, size_t lastIdx) const
 Extract a portion of the string.
virtual ~String ()
 Destroy class properly.
String tolower () const
 Return a lower case string.
String toupper () const
 Return an upper case string.

Static Public Member Functions

static String tolower (const String &str)
 Convert a string to a lower case string.
static String toupper (const String &str)
 Convert a string to a upper case string.
static String to_string (double val)
 Overload of the to_string C++11 function to allow for X-digits precision.
static String to_string (float val)
 Overload of the to_string C++11 function to allow for X-digits precision.
static String removeTrailing (const String &origin, const String &trailTag)
 The trailing tags of a string.

Detailed Description

Wrapper around the std::string class with augmented functionality.

Definition at line 16 of file String.h.

Constructor & Destructor Documentation

◆ String() [1/4]

utils::String::String ( )

Construct string.

Definition at line 13 of file String.cpp.

◆ String() [2/4]

utils::String::String ( const char * text)

Construct string.

Parameters
textThe string in char format

Definition at line 15 of file String.cpp.

◆ String() [3/4]

utils::String::String ( const String & text)

Construct string.

Parameters
textThe string in string format

Definition at line 17 of file String.cpp.

◆ String() [4/4]

utils::String::String ( const std::basic_string< char > & text)

Construct string.

Parameters
textThe string in vector char format

Definition at line 19 of file String.cpp.

◆ ~String()

utils::String::~String ( )
virtual

Destroy class properly.

Definition at line 74 of file String.cpp.

Member Function Documentation

◆ operator()() [1/2]

utils::String utils::String::operator() ( size_t idx) const

Get a specific character in the string.

Parameters
idxThe index of the character
Returns
The character

Definition at line 49 of file String.cpp.

◆ operator()() [2/2]

utils::String utils::String::operator() ( size_t startIdx,
size_t lastIdx ) const

Extract a portion of the string.

Parameters
startIdxThe index of the first character
lastIdxThe index of the last character
Returns
The portion of the string

Definition at line 57 of file String.cpp.

◆ operator+() [1/4]

utils::String utils::String::operator+ ( const char * text)

Append a char to the string.

Parameters
textThe char to add
Returns
The appended string

Definition at line 31 of file String.cpp.

◆ operator+() [2/4]

utils::String utils::String::operator+ ( double val)

Append a double to the string.

Parameters
valThe double to add
Returns
The appended string

Definition at line 37 of file String.cpp.

◆ operator+() [3/4]

utils::String utils::String::operator+ ( int val)

Append an int to the string.

Parameters
valThe int to add
Returns
The appended string

Definition at line 45 of file String.cpp.

◆ operator+() [4/4]

utils::String utils::String::operator+ ( size_t val)

Append an unsigned int to the string.

Parameters
valThe unsinged int to add
Returns
The appended string

Definition at line 41 of file String.cpp.

◆ operator=()

utils::String & utils::String::operator= ( const String & other)

Allow to use operator=.

Parameters
otherThe other string
Returns
The string

Definition at line 22 of file String.cpp.

◆ removeTrailing()

utils::String utils::String::removeTrailing ( const String & origin,
const String & trailTag )
static

The trailing tags of a string.

Parameters
originThe string to remove the trailing tags from
trailTagThe tag to remove
Returns
The string without the trailing tag

Example : The string "2.82823000" will return "2.82823" for the tag "0"

Definition at line 106 of file String.cpp.

◆ to_string() [1/2]

utils::String utils::String::to_string ( double val)
static

Overload of the to_string C++11 function to allow for X-digits precision.

Parameters
valThe double to convert
Returns
The double converter to string

Definition at line 92 of file String.cpp.

◆ to_string() [2/2]

utils::String utils::String::to_string ( float val)
static

Overload of the to_string C++11 function to allow for X-digits precision.

Parameters
valThe float to convert
Returns
The float converter to string

Definition at line 99 of file String.cpp.

◆ tolower() [1/2]

utils::String utils::String::tolower ( ) const

Return a lower case string.

Returns
The lower case string

Definition at line 82 of file String.cpp.

◆ tolower() [2/2]

utils::String utils::String::tolower ( const String & str)
static

Convert a string to a lower case string.

Parameters
strThe string to convert
Returns
The new string

Definition at line 76 of file String.cpp.

◆ toupper() [1/2]

utils::String utils::String::toupper ( ) const

Return an upper case string.

Returns
The upper case string

Definition at line 90 of file String.cpp.

◆ toupper() [2/2]

utils::String utils::String::toupper ( const String & str)
static

Convert a string to a upper case string.

Parameters
strThe string to convert
Returns
The new string

Definition at line 84 of file String.cpp.


The documentation for this class was generated from the following files: