String library module

Contents

Offers methods for c-string manipulation, but also a string library based on gb_string, which is c-string friendly.

Classes

struct zpl_string_header

Typedefs

using zpl_string = char*
using zpl_string_header = struct zpl_string_header

Functions

auto zpl_char_to_lower(char c) -> char
auto zpl_char_to_upper(char c) -> char
auto zpl_char_is_space(char c) -> b32
auto zpl_char_is_digit(char c) -> b32
auto zpl_char_is_hex_digit(char c) -> b32
auto zpl_char_is_alpha(char c) -> b32
auto zpl_char_is_alphanumeric(char c) -> b32
auto zpl_digit_to_int(char c) -> i32
auto zpl_hex_digit_to_int(char c) -> i32
auto zpl_char_to_hex_digit(char c) -> u8
auto zpl_str_to_lower(char* str) -> void
auto zpl_str_to_upper(char* str) -> void
auto zpl_str_trim(char* str, b32 skip_newline) -> char*
auto zpl_str_skip(char* str, char c) -> char*
auto zpl_strlen(const char* str) -> isize
auto zpl_strnlen(const char* str, isize max_len) -> isize
auto zpl_strcmp(const char* s1, const char* s2) -> i32
auto zpl_strncmp(const char* s1, const char* s2, isize len) -> i32
auto zpl_strcpy(char* dest, const char* source) -> char*
auto zpl_strdup(zpl_allocator a, char* src, isize max_len) -> char*
auto zpl_strncpy(char* dest, const char* source, isize len) -> char*
auto zpl_strlcpy(char* dest, const char* source, isize len) -> isize
auto zpl_strrev(char* str) -> char*
auto zpl_strtok(char* output, const char* src, const char* delimit) -> const char*
auto zpl_str_split_lines(zpl_allocator alloc, char* source, b32 strip_whitespace) -> char**
auto zpl_str_has_prefix(const char* str, const char* prefix) -> b32
auto zpl_str_has_suffix(const char* str, const char* suffix) -> b32
auto zpl_char_first_occurence(const char* str, char c) -> const char*
auto zpl_char_last_occurence(const char* str, char c) -> const char*
auto zpl_str_concat(char* dest, isize dest_len, const char* src_a, isize src_a_len, const char* src_b, isize src_b_len) -> void
auto zpl_str_to_u64(const char* str, char** end_ptr, i32 base) -> u64
auto zpl_str_to_i64(const char* str, char** end_ptr, i32 base) -> i64
auto zpl_str_to_f32(const char* str, char** end_ptr) -> f32
auto zpl_str_to_f64(const char* str, char** end_ptr) -> f64
auto zpl_i64_to_str(i64 value, char* string, i32 base) -> void
auto zpl_u64_to_str(u64 value, char* string, i32 base) -> void
auto zpl_utf8_strlen(u8 const* str) -> isize
auto zpl_utf8_strnlen(u8 const* str, isize max_len) -> isize
auto zpl_utf8_to_ucs2(u16* buffer, isize len, u8 const* str) -> u16*
auto zpl_ucs2_to_utf8(u8* buffer, isize len, u16 const* str) -> u8*
auto zpl_utf8_to_ucs2_buf(u8 const* str) -> u16*
auto zpl_ucs2_to_utf8_buf(u16 const* str) -> u8*
auto zpl_utf8_decode(u8 const* str, isize str_len, Rune* codepoint) -> isize
auto zpl_utf8_codepoint_size(u8 const* str, isize str_len) -> isize
auto zpl_utf8_encode_rune(u8 buf[4], Rune r) -> isize
auto zpl_string_make_reserve(zpl_allocator a, isize capacity) -> zpl_string
auto zpl_string_make(zpl_allocator a, const char* str) -> zpl_string
auto zpl_string_make_length(zpl_allocator a, void const* str, isize num_bytes) -> zpl_string
auto zpl_string_sprintf(zpl_allocator a, char* buf, isize num_bytes, const char* fmt, ...) -> zpl_string
auto zpl_string_sprintf_buf(zpl_allocator a, const char* fmt, ...) -> zpl_string
auto zpl_string_free(zpl_string str) -> void
auto zpl_string_duplicate(zpl_allocator a, zpl_string const str) -> zpl_string
auto zpl_string_length(zpl_string const str) -> isize
auto zpl_string_capacity(zpl_string const str) -> isize
auto zpl_string_available_space(zpl_string const str) -> isize
auto zpl_string_clear(zpl_string str) -> void
auto zpl_string_append(zpl_string str, zpl_string const other) -> zpl_string
auto zpl_string_append_length(zpl_string str, void const* other, isize num_bytes) -> zpl_string
auto zpl_string_appendc(zpl_string str, const char* other) -> zpl_string
auto zpl_string_set(zpl_string str, const char* cstr) -> zpl_string
auto zpl_string_make_space_for(zpl_string str, isize add_len) -> zpl_string
auto zpl_string_allocation_size(zpl_string const str) -> isize
auto zpl_string_are_equal(zpl_string const lhs, zpl_string const rhs) -> b32
auto zpl_string_trim(zpl_string str, const char* cut_set) -> zpl_string
auto zpl_string_trim_space(zpl_string str) -> zpl_string
auto zpl_string_append_rune(zpl_string str, Rune r) -> zpl_string
auto zpl_string_append_fmt(zpl_string str, const char* fmt, ...) -> zpl_string

Defines

#define zpl_str_expand(str)
#define zpl_strchr
#define ZPL_STRING_HEADER(str)