StringΒΆ
#import "std/string"
string :: struct {
len: s64;
ptr: *u8;
}
Builtin string storage. string type could represent dynamic and compile time static strings.
// Compile-time string literal
my_string :: "This is my string!";
// Dynamic string allocated on heap.
// New dynamic string can be created from string literal.
my_string :: string_new("This is my string!");
defer string_delete(my_string);
BL strings are zero terminated except of sub-string view function (terminator cannot be added because we cannot modify original string).
Note
String manipulation functions are related only to dynamic strings and cannot be used with string literals since those are constants allocated on stack.
- string_append
- string_clear
- string_clear_concat
- string_compare
- string_compare2
- string_concatenate
- string_count
- string_delete
- string_empty
- string_erase
- string_hash
- string_insert
- string_is_empty
- string_is_null
- string_is_null_or_empty
- string_is_zero_terminated
- string_new
- string_replace_all
- string_split_at_index
- string_split_by
- string_split_by_first
- string_split_by_last
- string_sub
- string_to_f32
- string_to_lower
- string_to_s64
- string_to_upper