#include <faith/string.h>
Public Member Functions | |
| String () | |
| String (const String &s) | |
| String (const std::string &s) | |
| String (const char *s) | |
| ~String () | |
| bool | isNull () const |
| bool | isEmpty () const |
| bool | operator== (const String &other) const |
| int | compare (const String &text) const |
| bool | operator< (const ::Faith::String &b) const |
| bool | operator> (const ::Faith::String &b) const |
| String & | operator= (const String &set) |
| String & | operator= (const Char &set) |
| String & | operator+= (const String &append) |
| String & | operator+= (char c) |
| String & | operator+= (const Char &c) |
| Faith::String | operator+ (const char *b) |
| Char | operator[] (int at) const |
| CharRef | operator[] (int at) |
| int | find (const String &other, int start=0) const |
| int | find (const Char &other, int start=0) const |
| int | find (char other, int start=0) const |
| int | find (bool(Char::*test)() const, int start=0) const |
| int | find (bool uninverted, bool(Char::*test)() const, int start=0) const |
| String | mid (int start, int length=-1) const |
| void | insert (int offset, const String &str) |
| void | replace (int start, int len, const String &str) |
| void | replace (const String &other, const String &replace, int start=0) |
| void | replace (const Char &other, const String &replace, int start=0) |
| void | replace (char other, const String &replace, int start=0) |
| int | length () const |
| void | setLocal8Bit (const CString &str) |
| void | setLocal8Bit (const char *str) |
| void | setUtf8 (const CString &str) |
| void | setUtf8 (const char *str) |
| void | setLatin1 (const CString &str) |
| void | setLatin1 (const char *str) |
| CString | exportTo (const CString &codepage) const |
| CString | local8Bit () const |
| CString | latin1 () const |
| Faith::String | left (int n) const |
| void | setCharAt (int offset, const Char &ch) |
| int | toInt (int base=10) const |
| bool | beginsWith (const String &str) const |
| String | simplifiedWhiteSpace () const |
| String | removedWhiteSpace () const |
Static Public Member Functions | |
| static String | fromLocal8Bit (const char *str) |
| static String | fromLocal8Bit (const CString &) |
| static String | fromLatin1 (const char *) |
| static String | fromLatin1 (const CString &) |
| static String | fromUtf8 (const char *str) |
| static String | number (int n, int base=10) |
| static String | number (long n, int base=10) |
| static String | number (double n, char format='g', int precision=6) |
Internally, this class stores the string in UTF-16, which permits storing 32-bit unicode values. That means that sometimes a single character may occupy more than one byte. You might thing I'm getting UTF 8 and UTF-16 confused, but I'm not, this paragraph is accurate.
Since no other component of OSes these days support 32 Bit unicode characters, this feature may be completely ignored, safely.
| Faith::String::String | ( | ) |
construct a null string
| Faith::String::String | ( | const String & | s | ) |
copy this other string
| Faith::String::String | ( | const std::string & | s | ) |
copy this other string
| Faith::String::String | ( | const char * | s | ) |
copy this other string, latin1 encoded. Be aware that it's latin1, so you can't store unicode characters in it
| Faith::String::~String | ( | ) |
| bool Faith::String::beginsWith | ( | const String & | str | ) | const |
str.| int Faith::String::compare | ( | const String & | text | ) | const |
text is less than this string, bitwise
+1 if text is more than this string, bitwise
0 if text is the same as this string
convert this string to a string with the codepage of codepage.
Codepage may equal something like utf8 or local8Bit
| int Faith::String::find | ( | bool | uninverted, | |
| bool(Char::*)() const | test, | |||
| int | start = 0 | |||
| ) | const |
the same as the above function, except that if uninverted is false, the behavior of the test is inverted (therefor, if the test function fails, a match is made at that point)
| int Faith::String::find | ( | bool(Char::*)() const | test, | |
| int | start = 0 | |||
| ) | const [inline] |
locate the first occurance of a character for which test returns true.
This function exists because I needed to use Regular Expressions before implementing them :)
The next function also permits inverting the behavior of the test.
find(&Char::isSpace)
| int Faith::String::find | ( | char | other, | |
| int | start = 0 | |||
| ) | const |
locate the first occurance of other in the string, starting at the position of start.
| int Faith::String::find | ( | const Char & | other, | |
| int | start = 0 | |||
| ) | const |
locate the first occurance of other in the string, starting at the position of start.
| int Faith::String::find | ( | const String & | other, | |
| int | start = 0 | |||
| ) | const |
locate the first occurance of other in the string, starting at the position of start.
| static String Faith::String::fromLatin1 | ( | const char * | ) | [static] |
| static String Faith::String::fromLocal8Bit | ( | const char * | str | ) | [inline, static] |
| static String Faith::String::fromUtf8 | ( | const char * | str | ) | [inline, static] |
| void Faith::String::insert | ( | int | offset, | |
| const String & | str | |||
| ) |
inserts string into the string at offset, if offset is larger than possible, it appends it
| bool Faith::String::isEmpty | ( | ) | const [inline] |
| bool Faith::String::isNull | ( | ) | const |
| CString Faith::String::latin1 | ( | ) | const |
same as exportTo("ISO8859-1")
| Faith::String Faith::String::left | ( | int | n | ) | const |
n characters from the string | int Faith::String::length | ( | ) | const |
| String Faith::String::mid | ( | int | start, | |
| int | length = -1 | |||
| ) | const |
start, and having a length of length. If length is negative,the rest of the string. If this string is Null,
a null string.
| static String Faith::String::number | ( | double | n, | |
| char | format = 'g', |
|||
| int | precision = 6 | |||
| ) | [static] |
creates a string of the given number, the format and precision parameters are exactly the same as printf
| static String Faith::String::number | ( | long | n, | |
| int | base = 10 | |||
| ) | [inline, static] |
| static String Faith::String::number | ( | int | n, | |
| int | base = 10 | |||
| ) | [static] |
| Faith::String Faith::String::operator+ | ( | const char * | b | ) | [inline] |
append the given character to me
appending a null char to a null string results in a null string
| String& Faith::String::operator+= | ( | char | c | ) |
append the given character to me
appending a null char to a null string results in a null string
append the given string to me
appending a null string to a null string results in a null string
| bool Faith::String::operator< | ( | const ::Faith::String & | b | ) | const [inline] |
| bool Faith::String::operator== | ( | const String & | other | ) | const |
Compare this string with other, whether they are the same.
| bool Faith::String::operator> | ( | const ::Faith::String & | b | ) | const [inline] |
| CharRef Faith::String::operator[] | ( | int | at | ) |
returns the character at the given offset.
Has undefined behavior if there isn't a character there.
| Char Faith::String::operator[] | ( | int | at | ) | const |
returns the character at the given offset.
Has undefined behavior if there isn't a character there
| String Faith::String::removedWhiteSpace | ( | ) | const |
| void Faith::String::replace | ( | char | other, | |
| const String & | replace, | |||
| int | start = 0 | |||
| ) |
locate all occurances of other in the string, starting at the position of start, replace it with replace
locate all occurances of other in the string, starting at the position of start, replace it with replace
locate all occurances of other in the string, starting at the position of start, replace it with replace
| void Faith::String::replace | ( | int | start, | |
| int | len, | |||
| const String & | str | |||
| ) |
removes the text from start and len characters forward, replacing it with the text str
| void Faith::String::setCharAt | ( | int | offset, | |
| const Char & | ch | |||
| ) |
| void Faith::String::setLatin1 | ( | const char * | str | ) |
| void Faith::String::setLatin1 | ( | const CString & | str | ) |
| void Faith::String::setLocal8Bit | ( | const char * | str | ) |
| void Faith::String::setLocal8Bit | ( | const CString & | str | ) |
| void Faith::String::setUtf8 | ( | const char * | str | ) |
| void Faith::String::setUtf8 | ( | const CString & | str | ) |
| String Faith::String::simplifiedWhiteSpace | ( | ) | const |
| int Faith::String::toInt | ( | int | base = 10 |
) | const |
1.4.7