Adding String.string-set!

Issue #94
This commit is contained in:
Chris Hall 2018-05-19 16:49:48 +10:00
parent 531a7eec1a
commit bc43a413e1
2 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@
(register from-chars (Fn [&(Array Char)] String))
(register tail (λ [(Ref String)] String))
(register format (Fn [&String &String] String))
(register string-set! (Fn [&String Int Char] ()))
(defn /= [a b]
(not (= (the (Ref String) a) b)))

View File

@ -8,6 +8,10 @@ void String_delete(String s) {
CARP_FREE(s);
}
void String_string_MINUS_set_BANG_(String *s, int i, char ch) {
(*s)[i] = ch;
}
String String_copy(String *s) {
size_t len = strlen(*s) + 1;
String ptr = CARP_MALLOC(len);