![]() |
PIP 5.5.3
Platform-Independent Primitives
|
C-String class. More...
#include <piconstchars.h>
Public Member Functions | |
| PIConstChars () | |
| Contructs an null string. | |
| PIConstChars (const char *string) | |
| Contructs string from C-string "string". | |
| PIConstChars (const char *data, size_t size) | |
| Contructs string from "size" characters of buffer "data". | |
| PIConstChars (const PIConstChars &o) | |
| Contructs a copy of string. | |
| char | operator[] (size_t index) const |
Read-only access to character by index. | |
| char | at (size_t index) const |
Read-only access to character by index. | |
| const char * | data () const |
Returns char * string pointer. | |
| bool | isNull () const |
Returns true if string doesn`t have any data. | |
| bool | isEmpty () const |
Returns true if string is empty, i.e. length = 0, or null. | |
| bool | isNotEmpty () const |
Returns true if string is not empty, i.e. length > 0. | |
| bool | contains (char c) const |
Returns true if string contains character "c". | |
| size_t | length () const |
| Returns characters length of string. | |
| size_t | size () const |
| Returns characters length of string. | |
| ssize_t | size_s () const |
| Returns characters length of string. | |
| bool | startsWith (const PIConstChars &str) const |
| Returns if string starts with "str". | |
| bool | startsWith (const char c) const |
| Returns if string starts with "c". | |
| bool | endsWith (const PIConstChars &str) const |
| Returns if string ends with "str". | |
| bool | endsWith (const char c) const |
| Returns if string ends with "c". | |
| PIConstChars | mid (const int start, const int len=-1) const |
| Returns part of string from character at index "start" and maximum length "len". More... | |
| PIConstChars | left (const int len) const |
| Returns part of string from start and maximum length "len". More... | |
| PIConstChars | right (const int len) const |
| Returns part of string at end and maximum length "len". More... | |
| PIConstChars & | cutLeft (const int len) |
| Remove part of string from start and maximum length "len" and return this string. More... | |
| PIConstChars & | cutRight (const int len) |
| Remove part of string at end and maximum length "len" and return this string. More... | |
| PIConstChars | takeLeft (const int len) |
| Take a part from the begin of string with maximum length "len" and return it. More... | |
| PIConstChars | takeRight (const int len) |
| Take a part from the end of string with maximum length "len" and return it. More... | |
| PIConstChars & | trim () |
| Remove spaces at the start and at the end of string and return this string. More... | |
| PIConstChars | trimmed () const |
| Returns copy of this string without spaces at the start and at the end. More... | |
| PIString | toString () const |
| Returns as PIString. | |
| PIConstChars & | operator= (const PIConstChars &s) |
| Assign operator. | |
| PIConstChars & | operator= (PIConstChars &&s) |
| Assign move operator. | |
| PIConstChars & | operator= (const char *s) |
| Assign operator. | |
| bool | operator== (const PIConstChars &s) const |
| Compare operator. | |
| bool | operator!= (const PIConstChars &s) const |
| Compare operator. | |
| bool | operator< (const PIConstChars &s) const |
| Compare operator. | |
| bool | operator> (const PIConstChars &s) const |
| Compare operator. | |
| uint | hash () const |
| Returns hash of string content. | |
C-String class.
This is wrapper around const char * string. PIConstChars doesn`t copy string, just save pointer and size.
Provides API similar to string, with information and compare methods.
Used to more handly works with ordinary C-strings.
| PIConstChars PIConstChars::mid | ( | const int | start, |
| const int | len = -1 |
||
| ) | const |
| PIConstChars PIConstChars::left | ( | const int | len | ) | const |
| PIConstChars PIConstChars::right | ( | const int | len | ) | const |
| PIConstChars & PIConstChars::cutLeft | ( | const int | len | ) |
Remove part of string from start and maximum length "len" and return this string.
| PIConstChars & PIConstChars::cutRight | ( | const int | len | ) |
Remove part of string at end and maximum length "len" and return this string.
| PIConstChars PIConstChars::takeLeft | ( | const int | len | ) |
Take a part from the begin of string with maximum length "len" and return it.
| PIConstChars PIConstChars::takeRight | ( | const int | len | ) |
Take a part from the end of string with maximum length "len" and return it.
| PIConstChars & PIConstChars::trim | ( | ) |
Remove spaces at the start and at the end of string and return this string.
|
inline |
Returns copy of this string without spaces at the start and at the end.