started C implementation, created custom library for handling strings

This commit is contained in:
FantasyPvP
2024-11-02 22:39:16 +00:00
parent 3d3eeb142f
commit 83a71ae0a1
10 changed files with 488 additions and 30 deletions
+36
View File
@@ -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