28 char* m_string =
nullptr;
32 bool m_using_small =
true;
34 [[nodiscard]]
static int lex_value(
String const& other);
41 String(
char const*
string);
54 [[nodiscard]]
size_t length(
bool count_ansi =
true)
const;
55 [[nodiscard]]
char*
c_str();
56 [[nodiscard]]
const char*
c_str()
const;
62 [[nodiscard]]
String strip(
char strip_char =
' ')
const;
65 [[nodiscard]]
String center(
size_t width,
char fill =
' ')
const;
112int strlen(
const char* str);
113char*
itoa(
int base, int64_t number);
114char*
htoa(uint64_t number);
117bool strcmp(
char const* str1,
char const* str2);
123bool strncmp(
char const* str1,
char const* str2,
int length);
Creates a string using a using a combination of parts with the '<<' operator. Simmilar to the logger.
StringBuilder & operator<<(char const *str)
Append C-string to the StringBuilder.
String out
The output string.
Dynamically sized string with various operations.
String operator+(String const &other) const
Adds the other string to the string.
bool operator>=(String const &other) const
Checks if the sum of the ascii values of the characters in the string is greater than or equal to the...
bool operator<(String const &other) const
Checks if the sum of the ascii values of the characters in the string is less than the sum of the asc...
bool operator==(String const &other) const
Checks if one string is equal to another.
String strip(char strip_char=' ') const
Strips the string of whitespace.
bool operator<=(String const &other) const
Checks if the sum of the ascii values of the characters in the string is less than or equal to the su...
static String formatted(char const *format,...)
Creates a formated string. s = string, x = hex, d = decimal.
bool operator>(String const &other) const
Checks if the sum of the ascii values of the characters in the string is greater than the sum of the ...
String center(size_t width, char fill=' ') const
Centers the string in a specified width.
void copy(String const &other)
Copies the other string.
common::Vector< String > split(String const &delimiter) const
Splits the string by the delimiter.
String substring(size_t start, size_t length) const
Get a section of the string.
size_t length(bool count_ansi=true) const
Returns the length of the string.
String()
Construct a String, 0 length and only contains the null terminator.
bool starts_with(String const &other)
Checks if the string starts with the other string (must contain the same characters in the same order...
String & operator=(String const &other)
Sets the string to the other string.
String operator*(int times) const
Returns the string repeated a number of times.
bool equals(String const &other) const
Checks if one string is equal to another.
bool operator!=(String const &other) const
Checks if one string is not equal to another.
~String()
Destructor for the string, cleans up memory if needed.
String & operator+=(String const &other)
Adds the other string to the string.
char * c_str()
The char pointer representation of the current string.
char & operator[](size_t index)
Returns the character at the specified index.
Stores the left, top, width and height of a rectangle.
char * itoa(int base, int64_t number)
Converts integer to string.
constexpr int MAX_STRING_SMALL_STORAGE
How many characters can be stored in the small string optimization array.
bool strcmp(char const *str1, char const *str2)
Checks if one string pointer is equal to another string pointer.
bool strncmp(char const *str1, char const *str2, int length)
Checks if one string pointer is equal to another string pointer up to a specified length (each must b...
char * htoa(uint64_t number)
Converts hex to string.
int strlen(const char *str)
Gets the length of a string.
Defines a Vector class for dynamically storing an array of elements.