#if !defined(LD_CORE_STRING_H_)
#define LD_CORE_STRING_H_

#define S(x) Str8_Wrap(sizeof(x) - sizeof(*(x)), (U8 *) (x))
#define Sz(x) Str8_WrapZ((U8 *) (x))
#define Sl(x) { sizeof(x) - sizeof(*(x)), (U8 *) (x) }

#define Sv(x) (int) (x).count, (x).data
#define Sf(arena, fmt, ...) Str8_Format(arena, fmt, ##__VA_ARGS__)

function Str8 Str8_Wrap(S64 count, U8 *data);
function Str8 Str8_WrapRange(U8 *start, U8 *end);
function Str8 Str8_WrapZ(U8 *data);

function U64 Str8_Hash(Str8 v);

function Str8 Str8_Copy(M_Arena *arena, Str8 s);

function Str8 Str8_Format(M_Arena *arena, const char *format, ...);
function Str8 Str8_FormatArgs(M_Arena *arena, const char *format, va_list args);

typedef U32 Str8_EqualFlags;
enum {
	STR8_EQUAL_IGNORE_CASE = (1 << 0)
};

function B32 Str8_Equal(Str8 a, Str8 b, Str8_EqualFlags flags);

function Str8 Str8_Prefix(Str8 s, S64 count);
function Str8 Str8_Suffix(Str8 s, S64 count);

function Str8 Str8_RemoveAfterLast(Str8 s, U8 c);

function B32 Str8_EndsWith(Str8 s, Str8 suffix);

function U8 Chr_ToUppercase(U8 c);
function U8 Chr_ToLowercase(U8 c);

#endif  // LD_CORE_STRING_H_
