FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
Extra string utility/tools

Everything related to strings. More...

Functions

FGE_API bool fge::string::IsValidUtf8String (std::string const &str)
 Check if the provided string has valid utf8 encoded chars.
 
FGE_API uint8_t fge::string::ToUint8 (std::string const &str)
 Convert efficiently a string to an uint8_t.
 
FGE_API uint16_t fge::string::ToUint16 (std::string const &str)
 Convert efficiently a string to an uint16_t.
 
FGE_API uint32_t fge::string::ToUint32 (std::string const &str)
 Convert efficiently a string to an uint32_t.
 
FGE_API uint64_t fge::string::ToUint64 (std::string const &str)
 Convert efficiently a string to an uint64_t.
 
FGE_API int8_t fge::string::ToInt8 (std::string const &str)
 Convert efficiently a string to an int8_t.
 
FGE_API int16_t fge::string::ToInt16 (std::string const &str)
 Convert efficiently a string to an int16_t.
 
FGE_API int32_t fge::string::ToInt32 (std::string const &str)
 Convert efficiently a string to an int32_t.
 
FGE_API int64_t fge::string::ToInt64 (std::string const &str)
 Convert efficiently a string to an int64_t.
 
FGE_API unsigned int fge::string::ToUint (std::string const &str)
 Convert efficiently a string to an unsigned int.
 
FGE_API int fge::string::ToInt (std::string const &str)
 Convert efficiently a string to an int.
 
FGE_API unsigned long long int fge::string::ToUlong (std::string const &str)
 Convert efficiently a string to an unsigned long long int.
 
FGE_API long long int fge::string::ToLong (std::string const &str)
 Convert efficiently a string to an long long int.
 
FGE_API float fge::string::ToFloat (std::string const &str)
 Convert efficiently a string to a float.
 
FGE_API double fge::string::ToDouble (std::string const &str)
 Convert efficiently a string to a double.
 
FGE_API bool fge::string::ToBool (std::string const &str)
 Convert efficiently a string to a bool.
 
FGE_API void * fge::string::ToPtr (std::string const &str)
 Convert a string to a pointer (address)
 
FGE_API fge::Vector2f fge::string::ToVec2f (std::string const &str)
 Convert a string to a vector2<float>
 
FGE_API fge::Vector2u fge::string::ToVec2u (std::string const &str)
 Convert a string to a vector2<unsigned int>
 
FGE_API fge::Vector2i fge::string::ToVec2i (std::string const &str)
 Convert a string to a vector2<int>
 
FGE_API std::string fge::string::ToStr (bool val)
 Convert efficiently a boolean to a string.
 
FGE_API std::string fge::string::ToStr (char val)
 Convert efficiently a char to a string.
 
FGE_API std::string fge::string::ToStr (char16_t val)
 Convert efficiently a char16_t to a string.
 
FGE_API std::string fge::string::ToStr (char32_t val)
 Convert efficiently a char32_t to a string.
 
FGE_API std::string fge::string::ToStr (wchar_t val)
 Convert efficiently a wchar_t to a string.
 
FGE_API std::string fge::string::ToStr (signed char val)
 Convert efficiently a signed char to a string.
 
FGE_API std::string fge::string::ToStr (short int val)
 Convert efficiently a short int to a string.
 
FGE_API std::string fge::string::ToStr (int val)
 Convert efficiently a int to a string.
 
FGE_API std::string fge::string::ToStr (long int val)
 Convert efficiently a long int to a string.
 
FGE_API std::string fge::string::ToStr (long long int val)
 Convert efficiently a long long int to a string.
 
FGE_API std::string fge::string::ToStr (unsigned char val)
 Convert efficiently a unsigned char to a string.
 
FGE_API std::string fge::string::ToStr (unsigned short int val)
 Convert efficiently a unsigned short int to a string.
 
FGE_API std::string fge::string::ToStr (unsigned int val)
 Convert efficiently a unsigned int to a string.
 
FGE_API std::string fge::string::ToStr (unsigned long int val)
 Convert efficiently a unsigned long int to a string.
 
FGE_API std::string fge::string::ToStr (unsigned long long int val)
 Convert efficiently a unsigned long long int to a string.
 
FGE_API std::string fge::string::ToStr (float val)
 Convert efficiently a float to a string.
 
FGE_API std::string fge::string::ToStr (double val)
 Convert efficiently a double to a string.
 
FGE_API std::string fge::string::ToStr (long double val)
 Convert efficiently a long double to a string.
 
FGE_API std::string fge::string::ToStr (void *val)
 Convert a pointer (address) to a string.
 
FGE_API std::string fge::string::ToStr (void const *val)
 Convert a pointer (address) to a string.
 
template<class T >
std::string fge::string::ToStr (std::optional< T > const &val)
 Convert a optional value to a string.
 
FGE_API std::string fge::string::ToStr (fge::Vector2f const &val)
 Convert a vector2<float> to a string.
 
FGE_API std::string fge::string::ToStr (fge::Vector2u const &val)
 Convert a vector2<unsigned int> to a string.
 
FGE_API std::string fge::string::ToStr (fge::Vector2i const &val)
 Convert a vector2<int> to a string.
 
FGE_API std::string fge::string::ToStr (fge::Vector3f const &val)
 Convert a vector3<float> to a string.
 
FGE_API std::string fge::string::ToStr (fge::Vector3i const &val)
 Convert a vector3<int> to a string.
 
FGE_API std::string fge::string::ToStr (fge::Property const &val)
 Convert a Property to a string.
 
template<class T >
std::string fge::string::ToStr (std::list< T > const &val, char separator=' ')
 Convert a list of value to a string.
 
template<class T >
std::string fge::string::ToStr (std::vector< T > const &val, char separator=' ')
 Convert a vector of value to a string.
 
FGE_API std::size_t fge::string::Split (std::string const &str, std::vector< std::string > &output, char separator)
 Split a string into a vector of string.
 

Detailed Description

Everything related to strings.

Function Documentation

◆ IsValidUtf8String()

FGE_API bool fge::string::IsValidUtf8String ( std::string const & str)

Check if the provided string has valid utf8 encoded chars.

Parameters
strThe string to check
Returns
True if the string is valid, False otherwise

◆ Split()

FGE_API std::size_t fge::string::Split ( std::string const & str,
std::vector< std::string > & output,
char separator )

Split a string into a vector of string.

Parameters
strThe string to split
outputThe vector to fill
separatorThe separator to use
Returns
The number of element added to the vector

◆ ToBool()

FGE_API bool fge::string::ToBool ( std::string const & str)

Convert efficiently a string to a bool.

Parameters
strThe string to convert
Returns
The converted value or false if there is an error

◆ ToDouble()

FGE_API double fge::string::ToDouble ( std::string const & str)

Convert efficiently a string to a double.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToFloat()

FGE_API float fge::string::ToFloat ( std::string const & str)

Convert efficiently a string to a float.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToInt()

FGE_API int fge::string::ToInt ( std::string const & str)

Convert efficiently a string to an int.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToInt16()

FGE_API int16_t fge::string::ToInt16 ( std::string const & str)

Convert efficiently a string to an int16_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToInt32()

FGE_API int32_t fge::string::ToInt32 ( std::string const & str)

Convert efficiently a string to an int32_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToInt64()

FGE_API int64_t fge::string::ToInt64 ( std::string const & str)

Convert efficiently a string to an int64_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToInt8()

FGE_API int8_t fge::string::ToInt8 ( std::string const & str)

Convert efficiently a string to an int8_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToLong()

FGE_API long long int fge::string::ToLong ( std::string const & str)

Convert efficiently a string to an long long int.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToPtr()

FGE_API void * fge::string::ToPtr ( std::string const & str)

Convert a string to a pointer (address)

The contained string must be a hexadecimal number and can be prefixed by 0x or 0X.

Warning
This function is not really safe and should be used with caution
Parameters
strThe string to convert
Returns
The converted address or nullptr if there is an error

◆ ToStr() [1/29]

FGE_API std::string fge::string::ToStr ( bool val)

Convert efficiently a boolean to a string.

Note that this function return "1" for true and "0" for false.

Parameters
valThe boolean to convert
Returns
The converted string

◆ ToStr() [2/29]

FGE_API std::string fge::string::ToStr ( char val)

Convert efficiently a char to a string.

Parameters
valThe char to convert
Returns
The converted string

◆ ToStr() [3/29]

FGE_API std::string fge::string::ToStr ( char16_t val)

Convert efficiently a char16_t to a string.

Parameters
valThe char16_t to convert
Returns
The converted string

◆ ToStr() [4/29]

FGE_API std::string fge::string::ToStr ( char32_t val)

Convert efficiently a char32_t to a string.

Parameters
valThe char32_t to convert
Returns
The converted string

◆ ToStr() [5/29]

FGE_API std::string fge::string::ToStr ( double val)

Convert efficiently a double to a string.

Parameters
valThe double to convert
Returns
The converted string

◆ ToStr() [6/29]

FGE_API std::string fge::string::ToStr ( fge::Property const & val)

Convert a Property to a string.

This function meant to be a simple workaround for Property::ToString().

Parameters
valThe Property to convert
Returns
The converted string

◆ ToStr() [7/29]

FGE_API std::string fge::string::ToStr ( fge::Vector2f const & val)

Convert a vector2<float> to a string.

See also
ToVec2f
Parameters
valThe vector2 to convert
Returns
The converted string

◆ ToStr() [8/29]

FGE_API std::string fge::string::ToStr ( fge::Vector2i const & val)

Convert a vector2<int> to a string.

See also
ToVec2i
Parameters
valThe vector2 to convert
Returns
The converted string

◆ ToStr() [9/29]

FGE_API std::string fge::string::ToStr ( fge::Vector2u const & val)

Convert a vector2<unsigned int> to a string.

See also
ToVec2u
Parameters
valThe vector2 to convert
Returns
The converted string

◆ ToStr() [10/29]

FGE_API std::string fge::string::ToStr ( fge::Vector3f const & val)

Convert a vector3<float> to a string.

See also
ToVec3f
Parameters
valThe vector3 to convert
Returns
The converted string

◆ ToStr() [11/29]

FGE_API std::string fge::string::ToStr ( fge::Vector3i const & val)

Convert a vector3<int> to a string.

See also
ToVec3i
Parameters
valThe vector3 to convert
Returns
The converted string

◆ ToStr() [12/29]

FGE_API std::string fge::string::ToStr ( float val)

Convert efficiently a float to a string.

Parameters
valThe float to convert
Returns
The converted string

◆ ToStr() [13/29]

FGE_API std::string fge::string::ToStr ( int val)

Convert efficiently a int to a string.

Parameters
valThe int to convert
Returns
The converted string

◆ ToStr() [14/29]

FGE_API std::string fge::string::ToStr ( long double val)

Convert efficiently a long double to a string.

Parameters
valThe long double to convert
Returns
The converted string

◆ ToStr() [15/29]

FGE_API std::string fge::string::ToStr ( long int val)

Convert efficiently a long int to a string.

Parameters
valThe long int to convert
Returns
The converted string

◆ ToStr() [16/29]

FGE_API std::string fge::string::ToStr ( long long int val)

Convert efficiently a long long int to a string.

Parameters
valThe long long int to convert
Returns
The converted string

◆ ToStr() [17/29]

FGE_API std::string fge::string::ToStr ( short int val)

Convert efficiently a short int to a string.

Parameters
valThe short int to convert
Returns
The converted string

◆ ToStr() [18/29]

FGE_API std::string fge::string::ToStr ( signed char val)

Convert efficiently a signed char to a string.

Parameters
valThe signed char to convert
Returns
The converted string

◆ ToStr() [19/29]

template<class T >
std::string fge::string::ToStr ( std::list< T > const & val,
char separator = ' ' )

Convert a list of value to a string.

Template Parameters
TThe type of the list
Parameters
valThe list to convert
separatorThe wanted separator between each value
Returns
A string containing all the values of the list

◆ ToStr() [20/29]

template<class T >
std::string fge::string::ToStr ( std::optional< T > const & val)

Convert a optional value to a string.

Return NO_VALUE if the optional doesn't have a value.

Parameters
valThe optional value to convert
Returns
The converted string

◆ ToStr() [21/29]

template<class T >
std::string fge::string::ToStr ( std::vector< T > const & val,
char separator = ' ' )

Convert a vector of value to a string.

Template Parameters
TThe type of the list
Parameters
valThe vector to convert
separatorThe wanted separator between each value
Returns
A string containing all the values of the vector

◆ ToStr() [22/29]

FGE_API std::string fge::string::ToStr ( unsigned char val)

Convert efficiently a unsigned char to a string.

Parameters
valThe unsigned char to convert
Returns
The converted string

◆ ToStr() [23/29]

FGE_API std::string fge::string::ToStr ( unsigned int val)

Convert efficiently a unsigned int to a string.

Parameters
valThe unsigned int to convert
Returns
The converted string

◆ ToStr() [24/29]

FGE_API std::string fge::string::ToStr ( unsigned long int val)

Convert efficiently a unsigned long int to a string.

Parameters
valThe unsigned long int to convert
Returns
The converted string

◆ ToStr() [25/29]

FGE_API std::string fge::string::ToStr ( unsigned long long int val)

Convert efficiently a unsigned long long int to a string.

Parameters
valThe unsigned long long int to convert
Returns
The converted string

◆ ToStr() [26/29]

FGE_API std::string fge::string::ToStr ( unsigned short int val)

Convert efficiently a unsigned short int to a string.

Parameters
valThe unsigned short int to convert
Returns
The converted string

◆ ToStr() [27/29]

FGE_API std::string fge::string::ToStr ( void * val)

Convert a pointer (address) to a string.

This function write the address in hexadecimal format.

See also
ToPtr
Parameters
valThe address to convert
Returns
The converted string

◆ ToStr() [28/29]

FGE_API std::string fge::string::ToStr ( void const * val)

Convert a pointer (address) to a string.

This function write the address in hexadecimal format.

See also
ToPtr
Parameters
valThe address to convert
Returns
The converted string

◆ ToStr() [29/29]

FGE_API std::string fge::string::ToStr ( wchar_t val)

Convert efficiently a wchar_t to a string.

Parameters
valThe wchar_t to convert
Returns
The converted string

◆ ToUint()

FGE_API unsigned int fge::string::ToUint ( std::string const & str)

Convert efficiently a string to an unsigned int.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToUint16()

FGE_API uint16_t fge::string::ToUint16 ( std::string const & str)

Convert efficiently a string to an uint16_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToUint32()

FGE_API uint32_t fge::string::ToUint32 ( std::string const & str)

Convert efficiently a string to an uint32_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToUint64()

FGE_API uint64_t fge::string::ToUint64 ( std::string const & str)

Convert efficiently a string to an uint64_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToUint8()

FGE_API uint8_t fge::string::ToUint8 ( std::string const & str)

Convert efficiently a string to an uint8_t.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToUlong()

FGE_API unsigned long long int fge::string::ToUlong ( std::string const & str)

Convert efficiently a string to an unsigned long long int.

Parameters
strThe string to convert
Returns
The converted value or 0 if there is an error

◆ ToVec2f()

FGE_API fge::Vector2f fge::string::ToVec2f ( std::string const & str)

Convert a string to a vector2<float>

The vector value contained in the string must be separated by a space

Parameters
strThe string to convert
Returns
The converted vector or a vector with 0,0 if there is an error

◆ ToVec2i()

FGE_API fge::Vector2i fge::string::ToVec2i ( std::string const & str)

Convert a string to a vector2<int>

The vector value contained in the string must be separated by a space

Parameters
strThe string to convert
Returns
The converted vector or a vector with 0,0 if there is an error

◆ ToVec2u()

FGE_API fge::Vector2u fge::string::ToVec2u ( std::string const & str)

Convert a string to a vector2<unsigned int>

The vector value contained in the string must be separated by a space

Parameters
strThe string to convert
Returns
The converted vector or a vector with 0,0 if there is an error