43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
/* This software is licensed by the MIT License, see LICENSE file */
|
|
/* Copyright © 2022 Gregory Lirent */
|
|
|
|
#include <stdio.h>
|
|
#include "../include/array.h"
|
|
#include "../include/string.h"
|
|
|
|
typedef vtype_string str_t;
|
|
typedef vtype_array arr_t;
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
str_t str;
|
|
|
|
string_init(&str, "sed ut perspiciatis");
|
|
|
|
string_concat(&str, ", Unde omnis iste natus error sit voluptatem accusantium doloremque laudantium");
|
|
string_concat(&str, ", Totam rem aperiam eaque ipsa");
|
|
string_concat(&str, ", Quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt");
|
|
string_concat(&str, ", Explicabo.");
|
|
|
|
string_capitalize(&str);
|
|
|
|
string_reverse(&str);
|
|
|
|
printf("%s\n", str.buffer);
|
|
|
|
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 = at_array(&parts, i);
|
|
|
|
string_trim(value, 0);
|
|
|
|
printf("%s (%lu)\n", value->buffer, string_nmemb(value));
|
|
}
|
|
|
|
array_free(&parts);
|
|
string_free(&str);
|
|
}
|