Refactor string
This commit is contained in:
+5
-5
@@ -2,8 +2,8 @@
|
||||
/* Copyright © 2022 Gregory Lirent */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../include/extra/string.h"
|
||||
#include "../include/extra/array.h"
|
||||
#include "../include/array.h"
|
||||
#include "../include/string.h"
|
||||
|
||||
typedef vtype_string str_t;
|
||||
typedef vtype_array arr_t;
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char** argv) {
|
||||
|
||||
printf("%s\n", str.buffer);
|
||||
|
||||
arr_t parts = string_split(&str, ',', -1);
|
||||
arr_t parts = string_split(&str, ',');
|
||||
|
||||
printf("%lu\n", array_size(&parts));
|
||||
|
||||
for (size_t i = 0; i < array_size(&parts); ++i) {
|
||||
str_t* value = array_at(&parts, i);
|
||||
str_t* value = at_array(&parts, i);
|
||||
|
||||
string_trim_spaces(value);
|
||||
string_trim(value, 0);
|
||||
|
||||
printf("%s (%lu)\n", value->buffer, string_nmemb(value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user