feat(utf-8 string): implemented clear function
This commit is contained in:
parent
6ccf2e70bf
commit
681ca8f489
3 changed files with 14 additions and 1 deletions
|
|
@ -43,6 +43,7 @@ FledastyError fledasty_utf8_string_insert_before_string(FledastyUtf8String *curr
|
|||
FledastyError fledasty_utf8_string_insert_after_string(FledastyUtf8String *current_string, unsigned char *after_character_string, size_t after_character_string_size, unsigned char *character_string, size_t character_string_size);
|
||||
|
||||
FledastyError fledasty_utf8_string_pop(FledastyUtf8String *current_string);
|
||||
FledastyError fledasty_utf8_string_clear(FledastyUtf8String *current_string);
|
||||
|
||||
FledastyError fledasty_utf8_string_replace_string(FledastyUtf8String *current_string, unsigned char *replace_character_string, size_t replace_character_string_size, unsigned char *character_string, size_t character_string_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -198,6 +198,17 @@ FledastyError fledasty_utf8_string_pop(FledastyUtf8String *current_string) {
|
|||
return FLEDASTY_ERROR_NONE;
|
||||
}
|
||||
|
||||
FledastyError fledasty_utf8_string_clear(FledastyUtf8String *current_string) {
|
||||
if (current_string == NULL) {
|
||||
return FLEDASTY_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
current_string->size = 0;
|
||||
current_string->character_string[0] = '\0';
|
||||
|
||||
return FLEDASTY_ERROR_NONE;
|
||||
}
|
||||
|
||||
FledastyError fledasty_utf8_string_replace_string(FledastyUtf8String *current_string, unsigned char *replace_character_string, size_t replace_character_string_size, unsigned char *character_string, size_t character_string_size) {
|
||||
if (current_string == NULL || replace_character_string == NULL || replace_character_string_size == 0 || character_string == NULL || character_string_size == 0) {
|
||||
return FLEDASTY_ERROR_INVALID_POINTER;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,8 @@ int main() {
|
|||
if (!fledasty_utf8_string_validate(invalid_utf8, 2)) {
|
||||
printf("UTF-8 invalid string is invalid!\n");
|
||||
}
|
||||
|
||||
|
||||
fledasty_utf8_string_clear(&test_utf8_string);
|
||||
if (fledasty_utf8_string_is_empty(&test_utf8_string)) {
|
||||
printf("UTF-8 string is empty!\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue