mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added String.concat, List.clear
This commit is contained in:
committed by
Christoffer Lerno
parent
b5afa98507
commit
a749a4d265
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user