Added more helper methods to StringBuilder.

This commit is contained in:
Relintai 2024-04-27 18:53:54 +02:00
parent c0d74c2060
commit eebeadbe47
2 changed files with 13 additions and 0 deletions

View File

@ -57,6 +57,13 @@ StringBuilder &StringBuilder::append(const char *p_cstring) {
return *this; return *this;
} }
void StringBuilder::clear() {
string_length = 0;
strings.clear();
c_strings.clear();
appended_strings.clear();
}
String StringBuilder::as_string() const { String StringBuilder::as_string() const {
if (string_length == 0) { if (string_length == 0) {
return ""; return "";

View File

@ -50,6 +50,12 @@ public:
StringBuilder &append(const String &p_string); StringBuilder &append(const String &p_string);
StringBuilder &append(const char *p_cstring); StringBuilder &append(const char *p_cstring);
void clear();
_FORCE_INLINE_ uint32_t length() {
return string_length;
}
_FORCE_INLINE_ StringBuilder &operator+(const String &p_string) { _FORCE_INLINE_ StringBuilder &operator+(const String &p_string) {
return append(p_string); return append(p_string);
} }