37 lines
634 B
C
37 lines
634 B
C
#ifndef DYNSTR_H
|
|
#define DYNSTR_H
|
|
|
|
typedef struct {
|
|
int size;
|
|
int capacity;
|
|
char* data;
|
|
} String_t;
|
|
|
|
String_t str_with_capacity(int capacity);
|
|
|
|
String_t str_from_chars(char* string);
|
|
|
|
String_t str_from_slice(char* string, int len);
|
|
|
|
String_t str_new();
|
|
|
|
String_t* str_lines(String_t* self, int* numlines);
|
|
|
|
// String_t* str_split(String_t* self, int* res_len, char c);
|
|
|
|
void str_push(String_t* s, char c);
|
|
|
|
char str_pop(String_t* s);
|
|
|
|
void str_insert(String_t* s, int index, char c);
|
|
|
|
void str_remove(String_t* s, int index);
|
|
|
|
int str_dealloc(String_t* s);
|
|
|
|
char* to_chars(String_t* s);
|
|
|
|
int str_len(String_t* s);
|
|
|
|
#endif
|