Documentation

Text

Namespace

Text parsing and formatting.

int Text::ParseInt(const string&in str, int base = 10)

Parses the given string as an integer.

Returns int
int64 Text::ParseInt64(const string&in str, int base = 10)

Parses the given string as a 64 bit integer.

Returns int64
uint Text::ParseUInt(const string&in str, int base = 10)

Parses the given string as an unsigned integer.

Returns uint
uint64 Text::ParseUInt64(const string&in str, int base = 10)

Parses the given string as a 64 bit unsigned integer.

Returns uint64
float Text::ParseFloat(const string&in str)

Parses the given string as a float.

Returns float
double Text::ParseDouble(const string&in str)

Parses the given string as a double.

Returns double
vec4 Text::ParseHexColor(string str)

Parses the given string as a hexadecimal color such as "#FF0000".

Returns vec4
bool Text::TryParseInt(const string&in str, int&out, int base = 10)

Tries to parse the given string as an integer. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseInt64(const string&in str, int64&out, int base = 10)

Tries to parse the given string as a 64 bit integer. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseUInt(const string&in str, int&out, int base = 10)

Tries to parse the given string as an unsigned integer. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseUInt64(const string&in str, int64&out, int base = 10)

Tries to parse the given string as a 64 bit unsigned integer. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseFloat(const string&in str, float&out)

Parses the given string as a float. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseDouble(const string&in str, double&out)

Parses the given string as a double. This will return true only if the string was parsed entirely and was not empty.

Returns bool
bool Text::TryParseHexColor(string str, vec4&out)

Parses the given string as a hexadecimal color such as "#FF0000". This will return true only if the string was parsed entirely and was not empty.

Returns bool
string Text::FormatPointer(uint64 ptr)

Formats a pointer to its more representative hexadecimal format, for example: 0x12345678

Returns string
string Text::FormatGameColor(const vec3&in rgb)

Formats a color in Maniaplanet-style color formatting, for example: "$f00"

Returns string
string Text::FormatOpenplanetColor(const vec3&in rgb)

Formats a color in Openplanet-style UI color formatting, for example: "\$f00"

Returns string
string Text::StripFormatCodes(const string&in s)

Strips all Maniaplanet-style formatting codes from a string.

Returns string
string Text::StripNonColorFormatCodes(const string&in s)

Strips all non-color Maniaplanet-style formatting codes from a string.

Returns string
string Text::OpenplanetFormatCodes(const string&in s)

Takes a string, converts Maniaplanet-style formatting codes and turns them into Openplanet UI formatting codes. This will also get rid of all Openplanet-unsupported formatting codes.

Returns string
string Text::StripOpenplanetFormatCodes(const string&in s)

Strips all Openplanet-supported formatting codes from a string.

Returns string
string Text::EncodeHex(const string&in, bool upper = false)

Encodes a string so that all characters are encoded as a sequence of hexadecimal bytes. Note that if you want to encode binary data, you should probably use MemoryBuffer::ReadToHex instead.

Returns string
string Text::DecodeHex(const string&in)

Decodes a string where characters are encoded as a sequence of hexadecimal bytes. Note that if you want to decode binary data, you should probably use MemoryBuffer::WriteFromHex instead.

Returns string
string Text::EncodeBase64(const string&in, bool url = false)

Encode a string as a base64 encoded string. Note that if you want to encode binary data, you should probably use MemoryBuffer::ReadToBase64 instead.

Returns string
string Text::DecodeBase64(const string&in, bool url = false)

Decode a base64 encoded string to a string. Note that if you want to decode binary data, you should probably use MemoryBuffer::WriteFromBase64 instead.

Returns string