a wrapper around strings
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
#include <odweta/util.h>
|
||||
|
||||
typedef struct {
|
||||
char *content;
|
||||
size_t length;
|
||||
} string_t;
|
||||
|
||||
string_t *string_new(); // create a new empty string
|
||||
|
||||
string_t *string_from(char *chars); // create a new string from a given char_sequence
|
||||
|
||||
bool string_push_chars(string_t *this, char *chars); // append a char_sequence to a string
|
||||
bool string_push(string_t *this, string_t *other); // append a string to a string
|
||||
|
||||
compare_e string_compare(string_t *left, string_t* right); // compare two strings
|
||||
|
||||
void string_print(string_t *this); // print a string
|
||||
void string_println(string_t *this); // print a string with a \n
|
||||
|
||||
bool string_is_empty(string_t *this); // return true when s->content == ""
|
||||
|
||||
void string_cleanup(string_t *this); // memory cleanup
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user