|
CoreComponents 4.0.0
A Modern C++ Toolkit
|
String processing, number parsing and number formatting. More...
Classes | |
| class | Casefree< String > |
| Case-insensitive string comparism. More... | |
| class | Prefix |
| String prefix More... | |
| class | String |
| String of characters More... | |
| class | TextError |
| Text error More... | |
Macros | |
| #define | CC_XSTR(x) |
| Translate a macro expression into a C string. | |
Functions | |
| Format | fout (const String &pattern="") |
| Generate formatted text on the standard output stream. | |
| Format | ferr (const String &pattern="") |
| Generate formatted text on the standard error stream. | |
| template<class T> | |
| T | commonPrefix (const T &a, const T &b) |
| Determine the common prefix between a and b. | |
Character Functions | |
| template<class T> | |
| T | toLower (T ch) |
| Convert character ch to the corresponding lower-case character. | |
| template<class T> | |
| T | toUpper (T ch) |
| Convert character ch to the corresponding upper-case character. | |
| template<class T> | |
| bool | isLower (T ch) |
| Check if ch is a lower-case character. | |
| template<class T> | |
| bool | isUpper (T ch) |
| Check if ch is an upper-case character. | |
| template<class T> | |
| bool | isSpace (T ch) |
| Check if ch is a space character. | |
Text Input Functions | |
| long | scanToken (const String &text, Out< String > token, const char *lt=" \t\n", long i0=0, long i1=-1) |
| Scan for a sub-string up to a lexical termination | |
| bool | offsetToLinePos (const String &text, long offset, Out< long > line=None{}, Out< long > pos=None{}) |
| Map byte offset to editor coordinates | |
| bool | linePosToOffset (const String &text, long line, long pos, Out< long > offset=None{}) |
| Map editor coordinates to byte offset | |
| String | escape (const String &text) |
| Replace all non-printable and non-ASCII characters in text by escape sequences. | |
| String | normalize (const String &text, bool nameCase=true) |
| Common user input normalization. | |
| String | xmlEscape (const String &text) |
| Escape all XML tags an entities in text. | |
| String | xmlSanitize (const String &text) |
| Remove all XML tags and entities in text. | |
Number Formatting Functions | |
| template<class T> | |
| String | inum (T x, int base=10, int n=-1) |
| Convert an integer value to string. | |
| template<class T> | |
| String | dec (T x, int n=-1) |
| Convert an integer to a decimal string. | |
| template<class T> | |
| String | hex (T x, int n=-1) |
| Convert an integer to a hexadecimal string. | |
| String | hex (const Bytes &data, char a='A') |
| Convert data to hexadecimal. | |
| Bytes | readHex (const String &hex) |
| Convert hexadecimal literal hex to a byte array. | |
| String | hex (const String &data, char a='A') |
| Convert data to hexadecimal. | |
| template<class T> | |
| String | oct (T x, int n=-1) |
| Convert an integer to an octal string. | |
| template<class T> | |
| String | bin (T x, int n=-1) |
| Convert an integer to a binary string. | |
| String | fnum (double x, int precision=16, int base=10, int screen=6) |
| Convert a floating-point number to string. | |
| String | fixed (double x, int nf) |
| Convert a floating point number to a fixed point notation string. | |
| String | fixed (double x, int ni, int nf) |
| Convert a floating point number to a fixed point notation string. | |
| String | sci (float x, int precision=8) |
| Convert a floating point number to a exponential notation string. | |
| String | sci (double x, int precision=17) |
| Convert a floating point number to a exponential notation string. | |
| String | dec (float x, int precision=8) |
| Convert a floating point number to decimal string. | |
| String | dec (double x, int precision=17) |
| Convert a floating point number to decimal string. | |
Default Stringification Functions | |
| String | str (const String &x) |
| Convert x to string. | |
| String | str (const char *x) |
| Convert x to string. | |
| String | str (char *x) |
| Convert x to string. | |
| String | str (bool x) |
| Convert x to string. | |
| String | str (const void *x) |
| Convert x to string. | |
| String | str (char x) |
| Convert x to string. | |
| String | str (char32_t ch) |
| Convert an unicode character to a string. | |
| String | str (unsigned char x) |
| Convert x to string. | |
| String | str (unsigned short x) |
| Convert x to string. | |
| String | str (unsigned int x) |
| Convert x to string. | |
| String | str (unsigned long x) |
| Convert x to string. | |
| String | str (unsigned long long x) |
| Convert x to string. | |
| String | str (short x) |
| Convert x to string. | |
| String | str (int x) |
| Convert x to string. | |
| String | str (long x) |
| Convert x to string. | |
| String | str (long long x) |
| Convert x to string. | |
| String | str (float x) |
| Convert x to string. | |
| String | str (double x) |
| Convert x to string. | |
| template<class T> | |
| String | str (const List< T > &list) |
| Convert list to string. | |
| template<class K, class T, class O> | |
| String | str (const Map< K, T, O > &map) |
| Convert map to string. | |
| template<class K, class T, class O> | |
| String | str (const MultiMap< K, T, O > &map) |
| Convert map to string. | |
| template<class T, class O> | |
| String | str (const Set< T, O > &set) |
| Convert set to string. | |
| template<class T, class O> | |
| String | str (const MultiSet< T, O > &set) |
| Convert set to string. | |
| String | str (const Range &range) |
| Convert range to string. | |
| template<class T, unsigned j, unsigned i = j> | |
| String | str (const Bit< T, j, i > &bit) |
String processing, number parsing and number formatting.
| #define CC_XSTR | ( | x | ) |
Translate a macro expression into a C string.
| T toLower | ( | T | ch | ) |
Convert character ch to the corresponding lower-case character.
| T | Character type |
| long scanToken | ( | const String & | text, |
| Out< String > | token, | ||
| const char * | lt = " \t\n", | ||
| long | i0 = 0, | ||
| long | i1 = -1 ) |
Scan for a sub-string up to a lexical termination
| text | Input text |
| token | Return the scanned sub-string |
| lt | Set of lexical termination characters |
| i0 | Begin of range to scan (index of first character) |
| i1 | End of range to scan (index behind the last charater) |
| String inum | ( | T | x, |
| int | base = 10, | ||
| int | n = -1 ) |
Convert an integer value to string.
| T | Integer type |
| x | Integer value |
| base | Number base (2..62) |
| n | Maximum number of digits |
| T commonPrefix | ( | const T & | a, |
| const T & | b ) |
Determine the common prefix between a and b.
| T toUpper | ( | T | ch | ) |
Convert character ch to the corresponding upper-case character.
| T | Character type |
| bool isLower | ( | T | ch | ) |
Check if ch is a lower-case character.
| bool isUpper | ( | T | ch | ) |
Check if ch is an upper-case character.
| bool isSpace | ( | T | ch | ) |
Check if ch is a space character.
| bool offsetToLinePos | ( | const String & | text, |
| long | offset, | ||
| Out< long > | line = None{}, | ||
| Out< long > | pos = None{} ) |
Map byte offset to editor coordinates
| text | Text to scan |
| offset | Global byte offset |
| line | Returns the line number (starting with 1) |
| pos | Returns the byte offset on the target line (starting with 0) |
Map editor coordinates to byte offset
| text | Text to scan |
| line | Line number (starting with 1) |
| pos | Character offset on the line (starting with 0) |
| offset | Retunrs the global byte offset |
Replace all non-printable and non-ASCII characters in text by escape sequences.
Common user input normalization.
| text | Input text |
| nameCase | Make sure the first character is upper case |
| String dec | ( | T | x, |
| int | n = -1 ) |
Convert an integer to a decimal string.
| x | Integer value |
| n | Number of digits |
| String hex | ( | T | x, |
| int | n = -1 ) |
Convert an integer to a hexadecimal string.
| x | Integer value |
| n | Number of digits |
Convert data to hexadecimal.
| String oct | ( | T | x, |
| int | n = -1 ) |
Convert an integer to an octal string.
| x | Integer value |
| n | Number of digits |
| String bin | ( | T | x, |
| int | n = -1 ) |
Convert an integer to a binary string.
| x | Integer value |
| n | Number of digits |
| String fnum | ( | double | x, |
| int | precision = 16, | ||
| int | base = 10, | ||
| int | screen = 6 ) |
Convert a floating-point number to string.
| x | Floating-point value |
| precision | Number of significiant digits |
| base | Number base (2..62) |
| screen | Maximum absolute exponent for choosing a non-exponential notation |
| String fixed | ( | double | x, |
| int | nf ) |
Convert a floating point number to a fixed point notation string.
| x | Floating point value |
| nf | Number of fractional digits |
| String fixed | ( | double | x, |
| int | ni, | ||
| int | nf ) |
Convert a floating point number to a fixed point notation string.
| x | Floating point value |
| ni | Number of integral digits |
| nf | Number of fractional digits |
| String sci | ( | float | x, |
| int | precision = 8 ) |
Convert a floating point number to a exponential notation string.
| x | Integer value |
| precision | Number of significiant digits |
| String sci | ( | double | x, |
| int | precision = 17 ) |
Convert a floating point number to a exponential notation string.
| x | Integer value |
| precision | Number of significiant digits |
| String dec | ( | float | x, |
| int | precision = 8 ) |
Convert a floating point number to decimal string.
| x | Floating point number |
| precision | Number of significiant digits |
| String dec | ( | double | x, |
| int | precision = 17 ) |
Convert a floating point number to decimal string.
| x | Floating point number |
| precision | Number of significiant digits |
| String str | ( | const char * | x | ) |
Convert x to string.
| String str | ( | char * | x | ) |
Convert x to string.
| String str | ( | bool | x | ) |
Convert x to string.
| String str | ( | const void * | x | ) |
Convert x to string.
| String str | ( | char | x | ) |
Convert x to string.
| String str | ( | char32_t | ch | ) |
Convert an unicode character to a string.
| String str | ( | unsigned char | x | ) |
Convert x to string.
| String str | ( | unsigned short | x | ) |
Convert x to string.
| String str | ( | unsigned int | x | ) |
Convert x to string.
| String str | ( | unsigned long | x | ) |
Convert x to string.
| String str | ( | unsigned long long | x | ) |
Convert x to string.
| String str | ( | short | x | ) |
Convert x to string.
| String str | ( | int | x | ) |
Convert x to string.
| String str | ( | long | x | ) |
Convert x to string.
| String str | ( | long long | x | ) |
Convert x to string.
| String str | ( | float | x | ) |
Convert x to string.
| String str | ( | double | x | ) |
Convert x to string.
Convert map to string.