Files
CSPP-coursework/final/dynstr.h
T
2024-11-08 10:36:52 +00:00

41 lines
737 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_merge(String_t* s1, String_t* s2);
String_t str_new();
String_t* str_lines(String_t* self, int* numlines);
String_t str_slice(String_t* s, int start, int end);
// 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