started C implementation, created custom library for handling strings
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifndef DYNSTR_H
|
||||
#define DYNSTR_H
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int capacity;
|
||||
char* data;
|
||||
} String;
|
||||
|
||||
String str_with_capacity(int capacity);
|
||||
|
||||
String str_from_chars(char* string);
|
||||
|
||||
String str_from_slice(char* string, int len);
|
||||
|
||||
String str_new();
|
||||
|
||||
String* str_lines(String* self, int* numlines);
|
||||
|
||||
// String* str_split(String* self, int* res_len, char c);
|
||||
|
||||
void str_push(String* s, char c);
|
||||
|
||||
char str_pop(String* s);
|
||||
|
||||
void str_insert(String* s, int index, char c);
|
||||
|
||||
void str_remove(String* s, int index);
|
||||
|
||||
int str_dealloc(String* s);
|
||||
|
||||
char* to_chars(String* s);
|
||||
|
||||
int str_len(String* s);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user