uicore::Text Class Reference

Text string functions. More...

#include <text.h>

Static Public Member Functions

static std::string::size_type char_length (const std::string &str)
 Finds the number of characters in a UTF-8 string. More...
 
static ByteOrderMark detect_bom (const void *data, std::string::size_type length)
 Searches for a byte order mark. More...
 
static bool equal_caseless (const std::string &a, const std::string &b)
 Returns true if equal when doing a character case-insensitive comparison. More...
 
static std::string from_utf16 (const std::wstring &s)
 Convert from UTF-16 to UTF-8. More...
 
static std::string from_utf32 (unsigned int value)
 Convert Unicode code point to UTF-8. More...
 
static std::string from_wchar (wchar_t value)
 Convert UCS-2 code point to UTF-8. More...
 
static bool less_caseless (const std::string &a, const std::string &b)
 Returns true if less when doing a character case-insensitive comparison. More...
 
static bool parse_bool (const std::string &value)
 
static double parse_double (const std::string &value)
 
static float parse_float (const std::string &value)
 
static int parse_int32 (const std::string &value, int base=10)
 
static long long parse_int64 (const std::string &value, int base=10)
 
static unsigned int parse_uint32 (const std::string &value, int base=10)
 Parse a number. More...
 
static unsigned long long parse_uint64 (const std::string &value, int base=10)
 
static std::string remove_trailing_zeros (std::string text)
 Removes trailing zeros from floating point numbers. More...
 
static std::vector< std::stringsplit (const std::string &text, const std::string &split_string, bool skip_empty=true)
 Split text into a list. More...
 
static std::string to_lower (const std::string &s)
 Convert text to lowercase. More...
 
static std::string to_string (unsigned char value, int base=10, bool uppercase=false)
 Formats a number. More...
 
static std::string to_string (unsigned short value, int base=10, bool uppercase=false)
 
static std::string to_string (unsigned int value, int base=10, bool uppercase=false)
 
static std::string to_string (unsigned long long value)
 
static std::string to_string (char value, int base=10, bool uppercase=false)
 
static std::string to_string (short value, int base=10, bool uppercase=false)
 
static std::string to_string (int value, int base=10, bool uppercase=false)
 
static std::string to_string (long long value)
 
static std::string to_string (float value, int digits=6, bool remove_trailing_zeros=true)
 
static std::string to_string (double value, int digits=6, bool remove_trailing_zeros=true)
 
static std::string to_string (bool value)
 
static std::string to_upper (const std::string &s)
 Convert text to uppercase. More...
 
static std::wstring to_utf16 (const std::string &s)
 Convert from UTF-8 to UTF-16. More...
 
static std::string trim (const std::string &text)
 Trim whitespace from front and back. More...
 

Detailed Description

Text string functions.

Member Function Documentation

static std::string::size_type uicore::Text::char_length ( const std::string str)
static

Finds the number of characters in a UTF-8 string.

static ByteOrderMark uicore::Text::detect_bom ( const void *  data,
std::string::size_type  length 
)
static

Searches for a byte order mark.

static bool uicore::Text::equal_caseless ( const std::string a,
const std::string b 
)
static

Returns true if equal when doing a character case-insensitive comparison.

static std::string uicore::Text::from_utf16 ( const std::wstring &  s)
static

Convert from UTF-16 to UTF-8.

static std::string uicore::Text::from_utf32 ( unsigned int  value)
static

Convert Unicode code point to UTF-8.

static std::string uicore::Text::from_wchar ( wchar_t  value)
static

Convert UCS-2 code point to UTF-8.

static bool uicore::Text::less_caseless ( const std::string a,
const std::string b 
)
static

Returns true if less when doing a character case-insensitive comparison.

static bool uicore::Text::parse_bool ( const std::string value)
static
static double uicore::Text::parse_double ( const std::string value)
static
static float uicore::Text::parse_float ( const std::string value)
static
static int uicore::Text::parse_int32 ( const std::string value,
int  base = 10 
)
static
static long long uicore::Text::parse_int64 ( const std::string value,
int  base = 10 
)
static
static unsigned int uicore::Text::parse_uint32 ( const std::string value,
int  base = 10 
)
static

Parse a number.

static unsigned long long uicore::Text::parse_uint64 ( const std::string value,
int  base = 10 
)
static
static std::string uicore::Text::remove_trailing_zeros ( std::string  text)
static

Removes trailing zeros from floating point numbers.

If the input string is "42.21000", then this function returns "42.21". If the string is "42.00000", then it returns "42".

static std::vector<std::string> uicore::Text::split ( const std::string text,
const std::string split_string,
bool  skip_empty = true 
)
static

Split text into a list.

static std::string uicore::Text::to_lower ( const std::string s)
static

Convert text to lowercase.

static std::string uicore::Text::to_string ( unsigned char  value,
int  base = 10,
bool  uppercase = false 
)
inlinestatic

Formats a number.

References to_string().

Referenced by to_string().

static std::string uicore::Text::to_string ( unsigned short  value,
int  base = 10,
bool  uppercase = false 
)
inlinestatic

References to_string().

Referenced by to_string().

static std::string uicore::Text::to_string ( unsigned int  value,
int  base = 10,
bool  uppercase = false 
)
static
static std::string uicore::Text::to_string ( unsigned long long  value)
static
static std::string uicore::Text::to_string ( char  value,
int  base = 10,
bool  uppercase = false 
)
inlinestatic

References to_string().

Referenced by to_string().

static std::string uicore::Text::to_string ( short  value,
int  base = 10,
bool  uppercase = false 
)
inlinestatic

References to_string().

Referenced by to_string().

static std::string uicore::Text::to_string ( int  value,
int  base = 10,
bool  uppercase = false 
)
static
static std::string uicore::Text::to_string ( long long  value)
static
static std::string uicore::Text::to_string ( float  value,
int  digits = 6,
bool  remove_trailing_zeros = true 
)
static
static std::string uicore::Text::to_string ( double  value,
int  digits = 6,
bool  remove_trailing_zeros = true 
)
static
static std::string uicore::Text::to_string ( bool  value)
static
static std::string uicore::Text::to_upper ( const std::string s)
static

Convert text to uppercase.

static std::wstring uicore::Text::to_utf16 ( const std::string s)
static

Convert from UTF-8 to UTF-16.

static std::string uicore::Text::trim ( const std::string text)
static

Trim whitespace from front and back.


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