progress on url and new stuff

This commit is contained in:
2025-05-09 00:10:40 +02:00
parent fd30b35d10
commit 28a235b680
3 changed files with 397 additions and 141 deletions

View File

@ -4,7 +4,8 @@
#include <stddef.h>
/*
All functions return a new heap-allocated string to which the requested operation was applied to.
ATTENTION! THIS LIBRARY CURRENTLY LEAKS MEMORY!
Functions that return char*, return a new heap-allocated string.
The user of this library is responsible for freeing the memory of the result.
No function modifies the input string. The input string is copied at the beginning of a function.
Only 7-Bit Ascii is supported.
@ -17,6 +18,8 @@ int strops_is_uppercase(const char* string);
char* strops_insert_at_pos_string(const char* string, const char* string_to_insert, size_t pos);
char* strops_remove_at_pos_char(const char* string, size_t pos);
char* strops_remove_at_pos_string(const char* string, const char* string_to_remove, size_t pos);
char* strops_replace_at_pos_string(const char* string, const char* string_to_remove, const char* string_to_insert, size_t pos);
char* strops_trim_right_whitespace(const char* string);
char* strops_trim_left_whitespace(const char* string);
@ -35,9 +38,18 @@ char* strops_remove_string(const char* string, const char* string_to_remove);
size_t strops_word_count(const char* string);
/* https://www.w3schools.com/tags/ref_urlencode.asp */
int strops_is_url_encoded(const char* string);
/*
https://www.w3schools.com/tags/ref_urlencode.asp
PLEASE NEVER USE THEM WITHOUT UNDERSTANDING THEIR ISSUES!
They will fully remove the following '%20 %21 %22 %23 %24 %26 %27 %28 %29 %2A %2C %2E %2F \
%3B %3C %3E %3F %5B %5C %5D %5E %60 %7B %7C %7D %7E'
These will get turned into their ascii counterpart '%25 %2B %2D %2E %2F %3A %3D %40 %5F'
They will return NULL on failure
*/
char* strops_url_encode(const char* string);
char* strops_url_decode(const char* string);
#endif /* STROPS_H */