OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::String Class Reference

#include "String.h"

Static Public Member Functions

static std::string toLower (const std::string &_string)
 Changes the provided string to the lower case.
 
static std::string evaluateEscapeCharacters (const std::string &_string)
 Evaluates any escape characters in this string.
 
static std::list< std::string > split (const std::string &_str, char _splitBy, bool _skipEmpty=false)
 Split the provided string.
 
static std::list< std::string > split (const std::string &_str, const std::string &_splitBy, bool _skipEmpty=false)
 Split the provided string.
 
static std::list< std::wstring > split (const std::wstring &_str, wchar_t _splitBy, bool _skipEmpty=false)
 Split the provided string.
 
static std::list< std::wstring > split (const std::wstring &_str, const std::wstring &_splitBy, bool _skipEmpty=false)
 Split the provided string.
 
static std::list< std::string > smartSplit (const std::string &_str, const std::string &_splitBy, bool _evaluateEscapeCharacters=true, bool _skipEmpty=false)
 
static std::string replace (const std::string &_str, const std::string &_what, const std::string &_with)
 Replaces all what occurances in the provided string and returns the result.
 
static std::wstring replace (const std::wstring &_str, const std::wstring &_what, const std::wstring &_with)
 Replaces all what occurances in the provided string and returns the result.
 
static char * getCStringCopy (const std::string &_str)
 Creates a C-String copy of the provided C++ String.
 
static wchar_t * getCStringCopy (const std::wstring &_str)
 Creates a C-String copy of the provided C++ String.
 
template<class T >
static T toNumber (const std::string &_string, bool &_failed)
 Convert the provided string to a number.
 
template<class T >
static bool isNumber (const std::string &_string)
 Returns true if the provided string is a number.
 
template<class T >
static std::string numberToHexString (T _number, char _fill='0', int _length=16)
 Returns a hex string representing the provided number.
 

Member Function Documentation

◆ evaluateEscapeCharacters()

std::string ot::String::evaluateEscapeCharacters ( const std::string & _string)
static

Evaluates any escape characters in this string.

◆ getCStringCopy() [1/2]

char * ot::String::getCStringCopy ( const std::string & _str)
static

Creates a C-String copy of the provided C++ String.

◆ getCStringCopy() [2/2]

wchar_t * ot::String::getCStringCopy ( const std::wstring & _str)
static

Creates a C-String copy of the provided C++ String.

◆ isNumber()

template<class T >
bool ot::String::isNumber ( const std::string & _string)
inlinestatic

Returns true if the provided string is a number.

Template Parameters
TNumber type.
Parameters
_stringNumber string.

◆ numberToHexString()

template<class T >
std::string ot::String::numberToHexString ( T _number,
char _fill = '0',
int _length = 16 )
inlinestatic

Returns a hex string representing the provided number.

Parameters
_numberNumber to convert.
_fillFill character.
_lengthOutput string length.

◆ replace() [1/2]

std::string ot::String::replace ( const std::string & _str,
const std::string & _what,
const std::string & _with )
static

Replaces all what occurances in the provided string and returns the result.

◆ replace() [2/2]

std::wstring ot::String::replace ( const std::wstring & _str,
const std::wstring & _what,
const std::wstring & _with )
static

Replaces all what occurances in the provided string and returns the result.

◆ smartSplit()

std::list< std::string > ot::String::smartSplit ( const std::string & _str,
const std::string & _splitBy,
bool _evaluateEscapeCharacters = true,
bool _skipEmpty = false )
static

◆ split() [1/4]

std::list< std::string > ot::String::split ( const std::string & _str,
char _splitBy,
bool _skipEmpty = false )
static

Split the provided string.

Parameters
_strString to split
_splitByChar to split at
_skipEmptyIf true, all empty parts will be skipped

◆ split() [2/4]

std::list< std::string > ot::String::split ( const std::string & _str,
const std::string & _splitBy,
bool _skipEmpty = false )
static

Split the provided string.

Parameters
_strString to split
_splitByString to split at
_skipEmptyIf true, all empty parts will be skipped

◆ split() [3/4]

std::list< std::wstring > ot::String::split ( const std::wstring & _str,
const std::wstring & _splitBy,
bool _skipEmpty = false )
static

Split the provided string.

Parameters
_strString to split
_splitByString to split at
_skipEmptyIf true, all empty parts will be skipped

◆ split() [4/4]

std::list< std::wstring > ot::String::split ( const std::wstring & _str,
wchar_t _splitBy,
bool _skipEmpty = false )
static

Split the provided string.

Parameters
_strString to split
_splitByChar to split at
_skipEmptyIf true, all empty parts will be skipped

◆ toLower()

std::string ot::String::toLower ( const std::string & _string)
static

Changes the provided string to the lower case.

◆ toNumber()

template<class T >
T ot::String::toNumber ( const std::string & _string,
bool & _failed )
inlinestatic

Convert the provided string to a number.

Parameters
_stringString representing a number
_failedWill be set to true if the operation failed

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