Go to the documentation of this file.
18 #ifndef __LIBSTD_STRING_H
19 #define __LIBSTD_STRING_H
36 #define STRING_DEFAULT_SIZE 64
76 String(
const char *s,
const bool copy =
false);
157 virtual const char *
get(
const Size position)
const;
168 virtual const char &
at(
const Size position)
const;
180 virtual const char value(
const Size position)
const;
189 virtual bool contains(
const char character)
const;
225 bool endsWith(
const char * suffix)
const;
247 const bool caseSensitive =
true)
const;
260 const bool caseSensitive =
true,
277 bool match(
const char *mask)
const;
362 char *
string =
ZERO);
375 const bool sign =
false);
virtual const char value(const Size position) const
Return value at the given position.
void copy(Terminal *term, const teken_rect_t *rect, const teken_pos_t *pos)
Copy bytes to the terminal.
String & upper()
Convert all Characters to upper case.
virtual bool resize(const Size size)
Change the size of the String buffer.
String & pad(const Size length)
Pad line with trailing whitespace.
unsigned long ulong
Unsigned long number.
Size length() const
Same as count().
bool operator==(const String &str) const
Comparision operator.
virtual ~String()
Destructor.
virtual const char & at(const Size position) const
Returns a reference to the item at the given position.
Size set(const long number, const Number::Base base=Number::Dec, char *string=ZERO)
Set text-representation of a signed number.
Base
Numeral system base type.
virtual const char * get(const Size position) const
Returns the item at the given position.
virtual int compareTo(const String &str) const
Compares this String to the given String.
Number::Base m_base
Number format to use for convertions.
virtual bool reserve(const Size count)
Make sure at least given number of bytes available.
String & lower()
Convert all Characters to lower case.
List< String > split(const char delimiter) const
Split the String into parts separated by a delimiter.
Sequences are containers that provide indexed based storage of items.
String()
Default constructor.
const char * operator*() const
Dereference operator (read-only).
virtual bool contains(const char character) const
Check if the given character occurs in the String.
bool match(const char *mask) const
Matches the String against a mask.
virtual Size count() const
Number of characters in the string.
unsigned int Size
Any sane size indicator cannot go negative.
String & trim()
Remove leading and trailing whitespace from the String.
bool operator!=(const String &str) const
Inequal operator.
String substring(const Size index, const Size size=0) const
Returns a part of the String as a copy.
String & operator<<(const char *str)
Append character string to the String.
char * m_string
Current value of the String.
virtual Size size() const
Calculates the length of the String.
Size m_count
Length of the string text, excluding NULL byte(s) at the end.
bool endsWith(const String &suffix) const
Tests if this String ends with the specified suffix.
Size m_size
Size of the string buffer, including any NULL byte(s) at the end.
void operator=(const char *str)
Assignment operator.
bool startsWith(const String &prefix) const
Tests if this String starts with the specified prefix.
virtual bool equals(const String &str) const
Alias for compareTo().
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.
Size setUnsigned(const ulong number, const Number::Base base=Number::Dec, char *string=ZERO, const bool sign=false)
Set text-representation of an unsigned number.
bool m_allocated
True if the string buffer is a deep copy, false otherwise.