dyn_string.h
| 1 | #ifndef DYN_STRING_H |
| 2 | #define DYN_STRING_H |
| 3 | #define STRING_DEFAULT_SIZE 8 |
| 4 | #include <stdint.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <string.h> |
| 7 | #include <stdbool.h> |
| 8 | |
| 9 | typedef struct String |
| 10 | { |
| 11 | char* chars; |
| 12 | size_t capacity; |
| 13 | size_t length; |
| 14 | } String; |
| 15 | |
| 16 | String* new_string(void); |
| 17 | char string_at(const String* string, size_t index); |
| 18 | bool string_append(String* string, char item); |
| 19 | void string_remove(String* string, size_t index); |
| 20 | bool string_adjust_size(String* string, size_t size); |
| 21 | size_t* string_find_char(const String* haystack, const char needle); |
| 22 | bool string_insert(String* string, size_t index, char character); |
| 23 | bool string_concat(String* string, String* other); |
| 24 | |
| 25 | |
| 26 | #endif //DYN_STRING_H |
| 27 |