Inherits PIDeque< T >.
|
|
| PIString () |
| | Contructs an empty string.
|
| |
|
| PIString (const PIChar &c) |
| | Contructs string with single symbol "c".
|
| |
| | PIString (const char *str) |
| | Contructs string from c-string "str". More...
|
| |
| | PIString (const wchar_t *str) |
| | Contructs string from wchar_t c-string "str". More...
|
| |
|
| PIString (const string &str) |
| | Contructs string from std::string "str".
|
| |
|
| PIString (const PIByteArray &ba) |
| | Contructs string from byte array "ba".
|
| |
|
| PIString (const PIChar *str, const int len) |
| | Contructs string from "len" characters of buffer "str".
|
| |
| | PIString (const char *str, const int len) |
| | Contructs string from "len" characters of buffer "str". More...
|
| |
| | PIString (const int len, const char c) |
| | Contructs string as sequence of characters "c" of buffer with length "len". More...
|
| |
| | PIString (const int len, const PIChar &c) |
| | Contructs string as sequence of symbols "c" of buffer with length "len". More...
|
| |
| | operator const char * () |
| | Return c-string representation of string. More...
|
| |
|
| operator const string () |
| | Return std::string representation of string.
|
| |
|
PIChar | operator[] (const int pos) const |
| | Return symbol at index "pos".
|
| |
|
PIChar & | operator[] (const int pos) |
| | Return reference to symbol at index "pos".
|
| |
|
bool | operator== (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator== (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator== (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator== (const string &str) const |
| | Compare operator.
|
| |
|
bool | operator!= (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator!= (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator!= (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator!= (const string &str) const |
| | Compare operator.
|
| |
|
bool | operator< (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator< (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator< (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator< (const string &str) const |
| | Compare operator.
|
| |
|
bool | operator> (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator> (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator> (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator> (const string &str) const |
| | Compare operator.
|
| |
|
bool | operator<= (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator<= (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator<= (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator<= (const string &str) const |
| | Compare operator.
|
| |
|
bool | operator>= (const PIString &str) const |
| | Compare operator.
|
| |
|
bool | operator>= (const PIChar c) const |
| | Compare operator.
|
| |
|
bool | operator>= (const char *str) const |
| | Compare operator.
|
| |
|
bool | operator>= (const string &str) const |
| | Compare operator.
|
| |
| PIString & | operator<< (const PIString &str) |
| | Append string "str" at the end of string. More...
|
| |
| PIString & | operator<< (const PIChar &c) |
| | Append symbol "c" at the end of string. More...
|
| |
| PIString & | operator<< (const char *str) |
| | Append c-string "str" at the end of string. More...
|
| |
| PIString & | operator<< (const wchar_t *str) |
| | Append wchar_t c-string "str" at the end of string. More...
|
| |
|
PIString & | operator<< (const string &str) |
| | Append std::string "str" at the end of string.
|
| |
| PIString & | operator<< (const int &num) |
| | Append string representation of "num" at the end of string. More...
|
| |
| PIString & | operator<< (const short &num) |
| | Append string representation of "num" at the end of string. More...
|
| |
| PIString & | operator<< (const long &num) |
| | Append string representation of "num" at the end of string. More...
|
| |
| PIString & | operator<< (const float &num) |
| | Append string representation of "num" at the end of string. More...
|
| |
| PIString & | operator<< (const double &num) |
| | Append string representation of "num" at the end of string. More...
|
| |
|
PIString & | prepend (const PIString &str) |
| | Insert string "str" at the begin of string.
|
| |
|
PIString & | append (const PIString &str) |
| | Insert string "str" at the end of string.
|
| |
| PIString | mid (const int start, const int len=-1) const |
| | Return part of string from symbol at index "start" and maximum length "len". More...
|
| |
| PIString | left (const int len) const |
| | Return part of string from left and maximum length "len". More...
|
| |
| PIString | right (const int len) const |
| | Return part of string from right and maximum length "len". More...
|
| |
| PIString & | cutMid (const int start, const int len) |
| | Remove part of string from symbol as index "start" and maximum length "len" and return this string. More...
|
| |
| PIString & | cutLeft (const int len) |
| | Remove part of string from left and maximum length "len" and return this string. More...
|
| |
| PIString & | cutRight (const int len) |
| | Remove part of string from right and maximum length "len" and return this string. More...
|
| |
| PIString & | trim () |
| | Remove spaces at the start and at the end of string and return this string. More...
|
| |
| PIString | trimmed () const |
| | Return copy of this string without spaces at the start and at the end. More...
|
| |
| PIString & | replace (const int from, const int count, const PIString &with) |
| | Replace part of string from index "from" and maximum length "len" with string "with" and return this string. More...
|
| |
| PIString | replaced (const int from, const int count, const PIString &with) const |
| | Replace part copy of this string from index "from" and maximum length "len" with string "with" and return copied string. More...
|
| |
| PIString & | replace (const PIString &what, const PIString &with, bool *ok=0) |
| | Replace first founded substring "what" with string "with" and return this string. More...
|
| |
| PIString | replaced (const PIString &what, const PIString &with, bool *ok=0) const |
| | Replace first founded substring "what" with string "with" and return copied string. More...
|
| |
| PIString & | replaceAll (const PIString &what, const PIString &with) |
| | Replace all founded substrings "what" with strings "with" and return this string. More...
|
| |
| PIString & | repeat (int times) |
| | Repeat content of string "times" times and return this string. More...
|
| |
| PIString | repeated (int times) const |
| | Returns repeated "times" times string. More...
|
| |
| PIString & | insert (const int index, const PIChar &c) |
| | Insert symbol "c" after index "index" and return this string. More...
|
| |
| PIString & | insert (const int index, const char &c) |
| | Insert symbol "c" after index "index" and return this string. More...
|
| |
| PIString & | insert (const int index, const PIString &str) |
| | Insert string "str" after index "index" and return this string. More...
|
| |
| PIString & | insert (const int index, const char *c) |
| | Insert string "str" after index "index" and return this string. More...
|
| |
| PIString & | expandRightTo (const int len, const PIChar &c) |
| | Enlarge string to length "len" by addition sequence of symbols "c" at the end of string, and return this string. More...
|
| |
| PIString & | expandLeftTo (const int len, const PIChar &c) |
| | Enlarge string to length "len" by addition sequence of symbols "c" at the beginning of string, and return this string. More...
|
| |
| PIString & | reverse () |
| | Reverse string and return this string. More...
|
| |
| PIString | reversed () const |
| | Reverse copy of this string and return it. More...
|
| |
| PIString | takeMid (const int start, const int len=-1) |
| | Take a part of string from symbol at index "start" and maximum length "len" and return it. More...
|
| |
| PIString | takeLeft (const int len) |
| | Take a part from the begin of string with maximum length "len" and return it. More...
|
| |
| PIString | takeRight (const int len) |
| | Take a part from the end of string with maximum length "len" and return it. More...
|
| |
| PIString | takeSymbol () |
| | Take a symbol from the begin of this string and return it. More...
|
| |
| PIString | takeWord () |
| | Take a word from the begin of this string and return it. More...
|
| |
| PIString | takeCWord () |
| | Take a word with letters, numbers and '_' symbols from the begin of this string and return it. More...
|
| |
| PIString | takeLine () |
| | Take a line from the begin of this string and return it. More...
|
| |
| PIString | takeNumber () |
| | Take a number with C-format from the begin of this string and return it. More...
|
| |
| PIString | takeRange (const PIChar &start, const PIChar &end, const PIChar &shield= '\\') |
| | Take a range between "start" and "end" symbols from the begin of this string and return it. More...
|
| |
| int | lengthAscii () const |
| | Return real bytes count of this string. More...
|
| |
| const char * | data () const |
| | Return char * representation of this string. More...
|
| |
|
std::string | stdString () const |
| | Return std::string representation of this string.
|
| |
|
PIByteArray | toByteArray () const |
| | Return PIByteArray contains data() of this string.
|
| |
| PIStringList | split (const PIString &delim) const |
| | Split string with delimiter "delim" to PIStringList and return it. More...
|
| |
|
PIString | toUpperCase () const |
| | Convert each symbol in copyed string to upper case and return it.
|
| |
|
PIString | toLowerCase () const |
| | Convert each symbol in copyed string to lower case and return it.
|
| |
| int | find (const char str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return first occur position. More...
|
| |
| int | find (const PIString str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return first occur position. More...
|
| |
| int | find (const char *str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return first occur position. More...
|
| |
| int | find (const string str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return first occur position. More...
|
| |
| int | findLast (const char str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return last occur position. More...
|
| |
| int | findLast (const PIString str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return last occur position. More...
|
| |
| int | findLast (const char *str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return last occur position. More...
|
| |
| int | findLast (const string str, const int start=0) const |
| | Search substring "str" from symbol at index "start" and return last occur position. More...
|
| |
| int | findWord (const PIString &word, const int start=0) const |
| | Search word "word" from symbol at index "start" and return first occur position. More...
|
| |
| int | findCWord (const PIString &word, const int start=0) const |
| | Search C-style word "word" from symbol at index "start" and return first occur position. More...
|
| |
|
bool | startsWith (const PIString &str) const |
| | Return if string starts with "str".
|
| |
|
bool | endsWith (const PIString &str) const |
| | Return if string ends with "str".
|
| |
|
int | length () const |
| | Return symbols length of string.
|
| |
|
bool | isEmpty () const |
| | Return true if string is empty, i.e. length = 0.
|
| |
|
bool | toBool () const |
| | Return true if string equal "true", "yes", "on" or positive not null numeric value.
|
| |
|
char | toChar () const |
| | Return char numeric value of string.
|
| |
| short | toShort (int base=-1, bool *ok=0) const |
| | Return short numeric value of string in base "base". More...
|
| |
| ushort | toUShort (int base=-1, bool *ok=0) const |
| | Return ushort numeric value of string in base "base". More...
|
| |
| int | toInt (int base=-1, bool *ok=0) const |
| | Return int numeric value of string in base "base". More...
|
| |
| uint | toUInt (int base=-1, bool *ok=0) const |
| | Return uint numeric value of string in base "base". More...
|
| |
| long | toLong (int base=-1, bool *ok=0) const |
| | Return long numeric value of string in base "base". More...
|
| |
| ulong | toULong (int base=-1, bool *ok=0) const |
| | Return ulong numeric value of string in base "base". More...
|
| |
| llong | toLLong (int base=-1, bool *ok=0) const |
| | Return llong numeric value of string in base "base". More...
|
| |
| ullong | toULLong (int base=-1, bool *ok=0) const |
| | Return ullong numeric value of string in base "base". More...
|
| |
| float | toFloat () const |
| | Return float numeric value of string. More...
|
| |
| double | toDouble () const |
| | Return double numeric value of string. More...
|
| |
| ldouble | toLDouble () const |
| | Return ldouble numeric value of string. More...
|
| |
| PIString & | setNumber (const short value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const ushort value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const int value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const uint value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const long value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const ulong value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const llong &value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const ullong &value, int base=10, bool *ok=0) |
| | Set string content to numeric representation of "value" in base "base". More...
|
| |
| PIString & | setNumber (const float value) |
| | Set string content to numeric representation of "value". More...
|
| |
| PIString & | setNumber (const double &value) |
| | Set string content to numeric representation of "value". More...
|
| |
| PIString & | setNumber (const ldouble &value) |
| | Set string content to numeric representation of "value". More...
|
| |
| PIString & | setReadableSize (llong bytes) |
| | Set string content to human readable size in B/kB/MB/GB/TB. More...
|
| |
String class.
PIP use this class for use string information.
Synopsis
This class based on PIVector to store information. String is a sequence of PIChar and can contain multibyte symbols. Therefore real memory size of string is symbols count * 4. String can be constucted from many types of data and can be converted to many types. There are man operators and handly functions to use string as you wish.
To/from data convertions
Most common constructor is PIString(const char * str), where "str" is null-terminated string, e.g. "string". This is 7 chars with last char = 0. Also you can constructs PIString from single PIChar, PIByteArray, other PIString or sequency of the same characters with custom length.
This class has implicit conversions to const char * and std::string. Also there are functions to make same convertions:
Numeric operations
You can get symbolic representation of any numeric value with function setNumber(any integer value, int base = 10, bool * ok = 0). Default arguments are set for decimal base system, but you can choose any system from 2 to 40. There are the same static functions fromNumber(), that returns PIString.
Also there is function setReadableSize() which is set human-readable size in bytes, Kb, Mb, Gb or Pb. Static analog is readableSize().