String

Description

String manipulation.

Classes

class  StringUtil
 Utility class for manipulating Strings. More...
 
class  StringID
 A string identifier that provides very fast comparisons to other string identifiers. More...
 

Typedefs

template<typename T >
using BasicString = std::basic_string< T, std::char_traits< T >, StdAlloc< T > >
 Basic string that uses Banshee memory allocators. More...
 
template<typename T >
using BasicStringStream = std::basic_stringstream< T, std::char_traits< T >, StdAlloc< T > >
 Basic string stream that uses Banshee memory allocators. More...
 
typedef BasicString< wchar_t > WString
 Wide string used primarily for handling Unicode text. More...
 
typedef BasicString< char > String
 Narrow string used primarily for handling ASCII text. More...
 
typedef BasicStringStream< wchar_t > WStringStream
 Wide string stream used for primarily for constructing strings consisting of Unicode text. More...
 
typedef BasicStringStream< char > StringStream
 Wide string stream used for primarily for constructing strings consisting of ASCII text. More...
 

Functions

BS_UTILITY_EXPORT WString toWString (const String &source)
 Converts a narrow string to a wide string. More...
 
BS_UTILITY_EXPORT WString toWString (const char *source)
 Converts a narrow string to a wide string. More...
 
BS_UTILITY_EXPORT WString toWString (float val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a float to a string. More...
 
BS_UTILITY_EXPORT WString toWString (double val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a double to a string. More...
 
BS_UTILITY_EXPORT WString toWString (Radian val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a Radian to a string. More...
 
BS_UTILITY_EXPORT WString toWString (Degree val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a Degree to a string. More...
 
BS_UTILITY_EXPORT WString toWString (int val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an int to a string. More...
 
BS_UTILITY_EXPORT WString toWString (unsigned int val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an unsigned int to a string. More...
 
BS_UTILITY_EXPORT WString toWString (INT64 val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an 64bit integer to a string. More...
 
BS_UTILITY_EXPORT WString toWString (UINT64 val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an 64bit unsigned to a string. More...
 
BS_UTILITY_EXPORT WString toWString (char val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an narrow char unsigned to a string. More...
 
BS_UTILITY_EXPORT WString toWString (wchar_t val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an wide bit char unsigned to a string. More...
 
BS_UTILITY_EXPORT WString toWString (bool val, bool yesNo=false)
 Converts a boolean to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Vector2 &val)
 Converts a 2 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Vector2I &val)
 Converts a 2 dimensional integer vector to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Vector3 &val)
 Converts a 3 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Vector4 &val)
 Converts a 4 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Matrix3 &val)
 Converts a 3x3 matrix to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Matrix4 &val)
 Converts a 4x4 matrix to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Quaternion &val)
 Converts a Quaternion to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Color &val)
 Converts a color to a string. More...
 
BS_UTILITY_EXPORT WString toWString (const Vector< bs::WString > &val)
 Converts a vector of strings into a single string where the substrings are delimited by spaces. More...
 
BS_UTILITY_EXPORT String toString (const WString &source)
 Converts a wide string to a narrow string. More...
 
BS_UTILITY_EXPORT String toString (const wchar_t *source)
 Converts a wide string to a narrow string. More...
 
BS_UTILITY_EXPORT String toString (float val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a float to a string. More...
 
BS_UTILITY_EXPORT String toString (double val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a double to a string. More...
 
BS_UTILITY_EXPORT String toString (Radian val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a Radian to a string. More...
 
BS_UTILITY_EXPORT String toString (Degree val, unsigned short precision=6, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a Degree to a string. More...
 
BS_UTILITY_EXPORT String toString (int val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an int to a string. More...
 
BS_UTILITY_EXPORT String toString (unsigned int val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an unsigned int to a string. More...
 
BS_UTILITY_EXPORT String toString (INT64 val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts a 64bit int to a string. More...
 
BS_UTILITY_EXPORT String toString (UINT64 val, unsigned short width=0, char fill= ' ', std::ios::fmtflags flags=std::ios::fmtflags(0))
 Converts an 64bit unsigned int to a string. More...
 
BS_UTILITY_EXPORT String toString (bool val, bool yesNo=false)
 Converts a boolean to a string. More...
 
BS_UTILITY_EXPORT String toString (const Vector2 &val)
 Converts a 2 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT String toString (const Vector2I &val)
 Converts a 2 dimensional integer vector to a string. More...
 
BS_UTILITY_EXPORT String toString (const Vector3 &val)
 Converts a 3 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT String toString (const Vector4 &val)
 Converts a 4 dimensional vector to a string. More...
 
BS_UTILITY_EXPORT String toString (const Matrix3 &val)
 Converts a 3x3 matrix to a string. More...
 
BS_UTILITY_EXPORT String toString (const Matrix4 &val)
 Converts a 4x4 matrix to a string. More...
 
BS_UTILITY_EXPORT String toString (const Quaternion &val)
 Converts a Quaternion to a string. More...
 
BS_UTILITY_EXPORT String toString (const Color &val)
 Converts a color to a string. More...
 
BS_UTILITY_EXPORT String toString (const Vector< bs::String > &val)
 Converts a vector of strings into a single string where the substrings are delimited by spaces.
 
BS_UTILITY_EXPORT float parseFloat (const String &val, float defaultValue=0)
 Converts a String to a float. More...
 
BS_UTILITY_EXPORT INT32 parseINT32 (const String &val, INT32 defaultValue=0)
 Converts a String to a whole number. More...
 
BS_UTILITY_EXPORT UINT32 parseUINT32 (const String &val, UINT32 defaultValue=0)
 Converts a String to a whole number. More...
 
BS_UTILITY_EXPORT INT64 parseINT64 (const String &val, INT64 defaultValue=0)
 Converts a String to a whole number. More...
 
BS_UTILITY_EXPORT UINT64 parseUINT64 (const String &val, UINT64 defaultValue=0)
 Converts a String to a whole number. More...
 
BS_UTILITY_EXPORT bool parseBool (const String &val, bool defaultValue=0)
 Converts a String to a boolean. More...
 
BS_UTILITY_EXPORT bool isNumber (const String &val)
 Checks the String is a valid number value. More...
 
BS_UTILITY_EXPORT float parseFloat (const WString &val, float defaultValue=0)
 Converts a WString to a float. More...
 
BS_UTILITY_EXPORT INT32 parseINT32 (const WString &val, INT32 defaultValue=0)
 Converts a WString to a whole number. More...
 
BS_UTILITY_EXPORT UINT32 parseUINT32 (const WString &val, UINT32 defaultValue=0)
 Converts a WString to a whole number. More...
 
BS_UTILITY_EXPORT INT64 parseINT64 (const WString &val, INT64 defaultValue=0)
 Converts a WString to a whole number. More...
 
BS_UTILITY_EXPORT UINT64 parseUINT64 (const WString &val, UINT64 defaultValue=0)
 Converts a WString to a whole number. More...
 
BS_UTILITY_EXPORT bool parseBool (const WString &val, bool defaultValue=0)
 Converts a WString to a boolean. More...
 
BS_UTILITY_EXPORT bool isNumber (const WString &val)
 Checks the WString is a valid number value.
 

Internal

void BS_UTILITY_EXPORT __string_throwDataOverflowException ()
 Helper method that throws an exception regarding a data overflow. More...
 

Typedef Documentation

using BasicString = std::basic_string < T, std::char_traits<T>, StdAlloc<T> >

Basic string that uses Banshee memory allocators.

using BasicStringStream = std::basic_stringstream < T, std::char_traits<T>, StdAlloc<T> >

Basic string stream that uses Banshee memory allocators.

typedef BasicString<char> String

Narrow string used primarily for handling ASCII text.

typedef BasicStringStream<char> StringStream

Wide string stream used for primarily for constructing strings consisting of ASCII text.

typedef BasicString<wchar_t> WString

Wide string used primarily for handling Unicode text.

typedef BasicStringStream<wchar_t> WStringStream

Wide string stream used for primarily for constructing strings consisting of Unicode text.

Function Documentation

void BS_UTILITY_EXPORT bs::__string_throwDataOverflowException ( )

Helper method that throws an exception regarding a data overflow.

BS_UTILITY_EXPORT bool bs::isNumber ( const String val)

Checks the String is a valid number value.

BS_UTILITY_EXPORT bool bs::parseBool ( const String val,
bool  defaultValue = 0 
)

Converts a String to a boolean.

Note
Returns true if case-insensitive match of the start of the string matches "true", "yes" or "1", false otherwise.
BS_UTILITY_EXPORT bool bs::parseBool ( const WString val,
bool  defaultValue = 0 
)

Converts a WString to a boolean.

Note
Returns true if case-insensitive match of the start of the string matches "true", "yes" or "1", false otherwise.
BS_UTILITY_EXPORT float bs::parseFloat ( const String val,
float  defaultValue = 0 
)

Converts a String to a float.

Note
0.0f if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT float bs::parseFloat ( const WString val,
float  defaultValue = 0 
)

Converts a WString to a float.

Note
0.0f if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT INT32 bs::parseINT32 ( const String val,
INT32  defaultValue = 0 
)

Converts a String to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT INT32 bs::parseINT32 ( const WString val,
INT32  defaultValue = 0 
)

Converts a WString to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT INT64 bs::parseINT64 ( const String val,
INT64  defaultValue = 0 
)

Converts a String to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT INT64 bs::parseINT64 ( const WString val,
INT64  defaultValue = 0 
)

Converts a WString to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT UINT32 bs::parseUINT32 ( const String val,
UINT32  defaultValue = 0 
)

Converts a String to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT UINT32 bs::parseUINT32 ( const WString val,
UINT32  defaultValue = 0 
)

Converts a WString to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT UINT64 bs::parseUINT64 ( const String val,
UINT64  defaultValue = 0 
)

Converts a String to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT UINT64 bs::parseUINT64 ( const WString val,
UINT64  defaultValue = 0 
)

Converts a WString to a whole number.

Note
0 if the value could not be parsed, otherwise the numeric version of the string.
BS_UTILITY_EXPORT String bs::toString ( const WString source)

Converts a wide string to a narrow string.

BS_UTILITY_EXPORT String bs::toString ( const wchar_t *  source)

Converts a wide string to a narrow string.

BS_UTILITY_EXPORT String bs::toString ( float  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a float to a string.

BS_UTILITY_EXPORT String bs::toString ( double  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a double to a string.

BS_UTILITY_EXPORT String bs::toString ( Radian  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a Radian to a string.

BS_UTILITY_EXPORT String bs::toString ( Degree  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a Degree to a string.

BS_UTILITY_EXPORT String bs::toString ( int  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an int to a string.

BS_UTILITY_EXPORT String bs::toString ( unsigned int  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an unsigned int to a string.

BS_UTILITY_EXPORT String bs::toString ( INT64  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a 64bit int to a string.

BS_UTILITY_EXPORT String bs::toString ( UINT64  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an 64bit unsigned int to a string.

BS_UTILITY_EXPORT String bs::toString ( bool  val,
bool  yesNo = false 
)

Converts a boolean to a string.

Parameters
[in]valtrue to value.
[in]yesNo(optional) If set to true, result is "yes" or "no" instead of "true" or "false".
BS_UTILITY_EXPORT String bs::toString ( const Vector2 val)

Converts a 2 dimensional vector to a string.

Note
Format is "x y".
BS_UTILITY_EXPORT String bs::toString ( const Vector2I val)

Converts a 2 dimensional integer vector to a string.

Note
Format is "x y".
BS_UTILITY_EXPORT String bs::toString ( const Vector3 val)

Converts a 3 dimensional vector to a string.

Note
Format is "x y z".
BS_UTILITY_EXPORT String bs::toString ( const Vector4 val)

Converts a 4 dimensional vector to a string.

Note
Format is "x y z w".
BS_UTILITY_EXPORT String bs::toString ( const Matrix3 val)

Converts a 3x3 matrix to a string.

Note
Format is "00 01 02 10 11 12 20 21 22".
BS_UTILITY_EXPORT String bs::toString ( const Matrix4 val)

Converts a 4x4 matrix to a string.

Note
Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33".
BS_UTILITY_EXPORT String bs::toString ( const Quaternion val)

Converts a Quaternion to a string.

Note
Format is "w x y z".
BS_UTILITY_EXPORT String bs::toString ( const Color val)

Converts a color to a string.

Note
Format is "r g b a".
BS_UTILITY_EXPORT WString bs::toWString ( const String source)

Converts a narrow string to a wide string.

BS_UTILITY_EXPORT WString bs::toWString ( const char *  source)

Converts a narrow string to a wide string.

BS_UTILITY_EXPORT WString bs::toWString ( float  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a float to a string.

BS_UTILITY_EXPORT WString bs::toWString ( double  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a double to a string.

BS_UTILITY_EXPORT WString bs::toWString ( Radian  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a Radian to a string.

BS_UTILITY_EXPORT WString bs::toWString ( Degree  val,
unsigned short  precision = 6,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts a Degree to a string.

BS_UTILITY_EXPORT WString bs::toWString ( int  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an int to a string.

BS_UTILITY_EXPORT WString bs::toWString ( unsigned int  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an unsigned int to a string.

BS_UTILITY_EXPORT WString bs::toWString ( INT64  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an 64bit integer to a string.

BS_UTILITY_EXPORT WString bs::toWString ( UINT64  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an 64bit unsigned to a string.

BS_UTILITY_EXPORT WString bs::toWString ( char  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an narrow char unsigned to a string.

BS_UTILITY_EXPORT WString bs::toWString ( wchar_t  val,
unsigned short  width = 0,
char  fill = ' ',
std::ios::fmtflags  flags = std::ios::fmtflags(0) 
)

Converts an wide bit char unsigned to a string.

BS_UTILITY_EXPORT WString bs::toWString ( bool  val,
bool  yesNo = false 
)

Converts a boolean to a string.

Parameters
[in]valValue to convert.
[in]yesNo(optional) If set to true, result is "yes" or "no" instead of "true" or "false".
BS_UTILITY_EXPORT WString bs::toWString ( const Vector2 val)

Converts a 2 dimensional vector to a string.

Note
Format is "x y".
BS_UTILITY_EXPORT WString bs::toWString ( const Vector2I val)

Converts a 2 dimensional integer vector to a string.

Note
Format is "x y".
BS_UTILITY_EXPORT WString bs::toWString ( const Vector3 val)

Converts a 3 dimensional vector to a string.

Note
Format is "x y z".
BS_UTILITY_EXPORT WString bs::toWString ( const Vector4 val)

Converts a 4 dimensional vector to a string.

Note
Format is "x y z w".
BS_UTILITY_EXPORT WString bs::toWString ( const Matrix3 val)

Converts a 3x3 matrix to a string.

Note
Format is "00 01 02 10 11 12 20 21 22".
BS_UTILITY_EXPORT WString bs::toWString ( const Matrix4 val)

Converts a 4x4 matrix to a string.

Note
Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33".
BS_UTILITY_EXPORT WString bs::toWString ( const Quaternion val)

Converts a Quaternion to a string.

Note
Format is "w x y z".
BS_UTILITY_EXPORT WString bs::toWString ( const Color val)

Converts a color to a string.

Note
Format is "r g b a".
BS_UTILITY_EXPORT WString bs::toWString ( const Vector< bs::WString > &  val)

Converts a vector of strings into a single string where the substrings are delimited by spaces.