Add new function string_set_n to extract a sub-string from a string.

This commit is contained in:
Patrick Pelissier committed 2017-08-14 23:30:20 +02:00
1 parent 9fc684515a
commit 866e1e0b7a
2 files changed
+22

No files matched your search

+5
View File
@@ -50,6 +50,11 @@ int main(void)
assert (strcmp(string_get_cstr(s1), "Hello") == 0);
string_clean(s1);
string_set_str (s1, "Hello");
string_set_str (s2, "Hello, world!");
string_set_n (s1, s2, 7, 5);
assert (strcmp(string_get_cstr(s1), "world") == 0);
string_set_str (s1, "Hello beautiful world!");
assert (string_size(s1) == 22);
assert (strcmp(string_get_cstr(s1), "Hello beautiful world!") == 0);