mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Some fixes to string. Added fprintf and String.printf. Updated boolerr example.
This commit is contained in:
@@ -75,7 +75,8 @@ fn void String.chop(String this, usize new_size)
|
||||
fn char[] String.str(String str)
|
||||
{
|
||||
StringData* data = (StringData*)str;
|
||||
return data.chars[0..data.len - 1];
|
||||
if (!data) return char[] {};
|
||||
return data.chars[:data.len];
|
||||
}
|
||||
|
||||
fn void String.append_utf32(String* str, Char32[] chars)
|
||||
@@ -173,6 +174,11 @@ fn ZString String.copy_zstr(String* str, Allocator allocator = { null, null })
|
||||
return (ZString)zstr;
|
||||
}
|
||||
|
||||
fn char[] String.copy_str(String* str, Allocator allocator = { null, null })
|
||||
{
|
||||
return str.copy_zstr(allocator)[:str.len()];
|
||||
}
|
||||
|
||||
fn bool String.equals(String str, String other_string)
|
||||
{
|
||||
StringData *str1 = str.data();
|
||||
|
||||
Reference in New Issue
Block a user