summaryrefslogtreecommitdiff
path: root/prb_string.h
blob: 85496cbd9b18afb842b5966cabb62328cde6969a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef PRB_STRING_H
#define PRB_STRING_H

#define str8lit(s) str8((U8 *)(s), sizeof(s)-1)
#define str8expand(s) (int)((s).length), ((s).ptr)

Str8 str8(U8 *ptr, U64 length);
Str8 str8_range(U8 *start, U8 *end);
Str8 str8_from_cstr(char *cstr);
char *str8_to_cstr(Arena *arena, Str8 s);
Str8 str8_chop_end(Str8 s, U64 count);
Str8 str8_chop_start(Str8 s, U64 count);
Str8 str8_pushfv(Arena *arena, char *fmt, va_list args);
Str8 str8_pushf(Arena *arena, char *fmt, ...);
void str8print(Str8 s);

Str8List *str8_list(Arena *arena);
void str8_list_push(Arena *arena, Str8List *list, Str8 str, B32 to_front);
void str8_list_pushf(Arena *arena, Str8List *list, B32 to_front, char *fmt, ...);
void str8_list_print(Str8List *list);

#endif /* PRB_STRING_H */