#ifndef _STRING
#define _STRING

#include "MemoryManager.h"
#include <stdarg.h>

typedef char* String;

/* Create */

String S_new(MemoryManager *mm, const char* str);
String S_newlen(MemoryManager *mm, usize length);
String S_dup(MemoryManager *mm, String s);

String S_vconcat(MemoryManager *mm, va_list args);
String S_concat(MemoryManager *mm, ...);
String S_vprintf(MemoryManager *mm, const char* fmt, va_list args);
String S_printf(MemoryManager *mm, const char* fmt, ...);

/* Free */

Result S_free(String *s);

/* Modify */

Result S_append(String *s, const char* str);
Result S_prepend(String *s, const char* str);

/* Get */

usize S_length(String s);
usize S_find(String s, char c);
String S_substr(MemoryManager *mm, String s, usize start, usize length);

#endif /* _STRING */
