aboutsummaryrefslogtreecommitdiff
path: root/src/strings.h
diff options
context:
space:
mode:
authoramy <[email protected]>2023-04-14 13:22:32 +0000
committeramy <[email protected]>2023-04-14 13:22:32 +0000
commitd769c253e8a6ddc67cf8424da2017d309e93f11b (patch)
treef62685a725836337ab29cd8c3448d49d53ed4004 /src/strings.h
init
Diffstat (limited to 'src/strings.h')
-rw-r--r--src/strings.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/strings.h b/src/strings.h
new file mode 100644
index 0000000..7a6fb08
--- /dev/null
+++ b/src/strings.h
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef __str__
+#define __str__
+//#define init_str(buffer) (buffer); \
+ {buffer = (char*)malloc(sizeof(char));\
+ buffer[0]='\0';}
+//#define str_size(str,sizeb) (sizeb); \
+ for(sizeb=0;;sizeb++)if(str[sizeb]=='\0')break;
+//#define str_push(str,ch)\
+ int size_y = str_size(str);\
+ str = (char*)realloc(str,sizeof(char*)*(size_y+1));\
+ str[size_y]=ch;\
+ str[size_y+1]='\0';
+typedef struct {
+ char*str;
+ int len;
+}str;
+str* str_init();
+int str_size(str*str);
+int ca_size(char*str);
+void str_pushc(str*str,char ch);
+void str_pushca(str*str,char*ins);
+int str_cmp_str(str*,str*);
+int str_cmp_ca(str*,char*);
+void str_free(str*str);
+str* str_init_only_str(str*str);
+void str_clear(str*str);
+#endif