Added String.concat, List.clear

This commit is contained in:
Nikos Plugachev
2022-12-12 10:22:19 -05:00
committed by Christoffer Lerno
parent b5afa98507
commit a749a4d265
2 changed files with 13 additions and 0 deletions

View File

@@ -301,3 +301,11 @@ private fn void String.reserve(String* str, usz addition)
if (new_capacity < MIN_CAPACITY) new_capacity = MIN_CAPACITY;
*str = (String)data.allocator.realloc(data, StringData.sizeof + new_capacity)!!;
}
fn String String.concat(String a, String b)
{
char[] result = str::concat(a.str(), b.str());
String resultString = new(result);
free(result);
return resultString;
}