Go to the documentation of this file.
112 return length((
const char *) str);
138 buffer =
new char[
size];
203 for (
Size i = 0; i < len; i++)
242 const bool caseSensitive,
243 const Size count)
const
245 const char *dest =
m_string, *src = str;
248 while (*dest && *src)
250 if (
count && n-1 == 0)
253 if (( caseSensitive && *dest != *src) ||
270 const char *end =
ZERO;
272 while (*
string && *mask)
289 for (; *string;
string++)
291 const char *s = string, *m = mask;
293 while (*s && *m && *s == *m)
302 else if (*
string != *mask)
305 if (*
string)
string++;
311 return (*
string == *mask);
410 const char str[] = { delimiter,
ZERO };
420 Size from = 0, i = 0;
423 char *saved =
copy.m_string;
442 copy.m_string++, i++;
452 copy.m_string = saved;
459 long acc = 0, cutoff;
460 bool negative =
false;
461 int cutlim, basenum = 10;
477 negative =
true; s++;
481 if (basenum == 16 && s[0] ==
'0' && s[1] ==
'x')
486 cutlim = cutoff % basenum;
499 unsigned char c = (
unsigned char) *s++;
513 if (acc < cutoff || (acc == cutoff && c > cutlim))
521 if (acc > cutoff || (acc == cutoff && c > cutlim))
543 char *p, *p1, *p2, *saved, tmp;
544 unsigned long ud = number;
545 int remainder, divisor = 10;
563 if (sign && (
long)number < 0)
581 remainder = ud % divisor;
582 *p++ = (remainder < 10) ? remainder +
'0' : remainder +
'a' - 10;
584 while (ud /= divisor);
bool isUpper(char c)
Test for an uppercase letter.
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.
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
virtual bool resize(const Size size)
Change the size of the String buffer.
bool isWildcard(char c)
Test for a wildcard character.
String & pad(const Size length)
Pad line with trailing whitespace.
unsigned long ulong
Unsigned long number.
Size length() const
Same as count().
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
bool operator==(const String &str) const
Comparision operator.
#define LONG_MAX
Maximum value of an object of type long int.
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.
#define STRING_DEFAULT_SIZE
Default maximum length of a String's value.
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.
bool isDigit(char c)
Test for a decimal digit.
List< String > split(const char delimiter) const
Split the String into parts separated by a delimiter.
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.
void append(T t)
Insert an item at the end of the list.
bool isAlpha(char c)
Test for an alphabetic character.
bool isWhitespace(char c)
Test for a white-space character.
unsigned int Size
Any sane size indicator cannot go negative.
String & trim()
Remove leading and trailing whitespace from the String.
#define LONG_MIN
Minimum value of an object of type long int.
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.
char upper(char c)
Converts the letter c to uppercase.
char lower(char c)
Converts the letter c to lowercase.
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.