libcproject
C static library easier to use than libc (C standard library).
|
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "character.h"
#include "convert.h"
#include "hash_map.h"
#include "types.h"
Go to the source code of this file.
Functions | |
size_t | string_get_length (const string_t string) |
Return the length of a string (excluding '\0'). More... | |
void | string_to_uppercase (string_t string) |
Converts all the alphabetic characters in a string to uppercase. More... | |
void | string_to_lowercase (string_t string) |
Converts all the alphabetic characters in a string to lowercase. More... | |
void | string_replace (string_t string, char search, char replace) |
Replace all the occurrences of search value into replace value in the string. More... | |
void | string_remove_character (string_t string, char search) |
Removes all the occurrences of a character in a string. More... | |
void | string_trim_start (string_t string, char character) |
Removes all character from the start of a string. More... | |
void | string_trim_end (string_t string, char character) |
Removes all character from the end of a string. More... | |
void | string_trim (string_t string, char character) |
Removes all character from the start and end of a string. More... | |
string_t | string_copy (const string_t string) |
Return the copy of a string. More... | |
void | string_capitalize (string_t string) |
Capitalizes the string. More... | |
size_t | string_total_occurrences_of_character (string_t string, char character) |
Returns the total number of occurrences of the given character in the string. More... | |
void | string_reverse (const string_t string) |
Reverse the characters in a string. More... | |
bool | string_equals (const string_t string1, const string_t string2) |
Check if two strings are equals. More... | |
bool | string_get_is_integer (const string_t string) |
Check if the string is an integer. More... | |
string_t * | string_split (const string_t string, char separator, size_t *result_size) |
Split a string into substrings using the specified separator and return them as an array and update the pointer result_size to the resulting size of the created array. More... | |
string_t | string_join (string_t *array, const char separator, size_t array_length) |
Adds all the elements of an array into a string, separated by the specified separator string. More... | |
void | string_concatenate (string_t *destination, string_t source) |
Concatenate two strings. More... | |
bool | string_get_has_unique_characters (const string_t string) |
Check if a string contains only unique characters. More... | |
string_t | string_substring (const string_t string, size_t index_start, size_t index_end) |
Returns the part of the string between the start and end indexes (both included). More... | |
bool | string_get_is_substring (const string_t string, const string_t substring) |
Check if a string contains a substring. More... | |
string_t | string_get_formatted_number (const int64_t number, string_t separator) |
Format a number to a string with specified separator. More... | |
string_t | string_get_last_occurence_of_character (const string_t string, char character) |
Returns a pointer to the last occurrence of character in the string. More... | |
bool | string_starts_with (const string_t string, const string_t prefix) |
Check if a string starts with a substring. More... | |
bool | string_ends_with (const string_t string, const string_t prefix) |
Check if a string ends with a substring. More... | |
size_t | string_position_of (const string_t string, const char character) |
Returns the position (index + 1) within the string of the first occurrence of the specified substring (0 if not found). More... | |
size_t | string_last_position_of (const string_t string, const char character) |
Returns the position (index + 1) within the string of the last occurrence of the specified substring (0 if not found). More... | |
string_t | string_pad_start (const string_t string, const string_t pad_string, size_t target_length) |
Pads a string with another pad_string (multiple times, if needed) until the resulting string reaches the target_length . The padding is applied from the start (left) of the string. More... | |
string_t | string_zero_pad (uint64_t number, size_t places) |
Pad a number with zeros. More... | |
size_t string_get_length | ( | const string_t | string | ) |
Return the length of a string (excluding '\0').
string |
void string_to_uppercase | ( | string_t | string | ) |
Converts all the alphabetic characters in a string to uppercase.
NOTE: Mutates the string.
string |
void string_to_lowercase | ( | string_t | string | ) |
Converts all the alphabetic characters in a string to lowercase.
NOTE: Mutates the string.
string |
void string_replace | ( | string_t | string, |
char | search, | ||
char | replace | ||
) |
Replace all the occurrences of search value into replace value in the string.
NOTE: Mutates the string.
string | |
search | A character search value. |
replace | A character containing the text to replace for match. |
void string_remove_character | ( | string_t | string, |
char | search | ||
) |
Removes all the occurrences of a character in a string.
NOTE: Mutates the string.
string | |
search | A character search value. |
void string_trim_start | ( | string_t | string, |
char | character | ||
) |
Removes all character
from the start of a string.
NOTE: Mutates the string.
string |
void string_trim_end | ( | string_t | string, |
char | character | ||
) |
Removes all character
from the end of a string.
NOTE: Mutates the string.
string |
void string_trim | ( | string_t | string, |
char | character | ||
) |
Removes all character
from the start and end of a string.
NOTE: Mutates the string.
string |
Return the copy of a string.
string |
void string_capitalize | ( | string_t | string | ) |
Capitalizes the string.
NOTE: Mutates the string.
string |
size_t string_total_occurrences_of_character | ( | string_t | string, |
char | character | ||
) |
Returns the total number of occurrences of the given character in the string.
string | |
character |
void string_reverse | ( | const string_t | string | ) |
Reverse the characters in a string.
NOTE: Mutates the string.
string |
Check if two strings are equals.
string1 | |
string2 |
bool string_get_is_integer | ( | const string_t | string | ) |
Check if the string is an integer.
string |
Split a string into substrings using the specified separator and return them as an array and update the pointer result_size
to the resulting size of the created array.
string | |
separator | |
result_size |
Adds all the elements of an array into a string, separated by the specified separator string.
array | |
separator | |
array_length |
Concatenate two strings.
NOTE: Mutates the string destination
.
destination | |
source |
bool string_get_has_unique_characters | ( | const string_t | string | ) |
Check if a string contains only unique characters.
string |
Returns the part of the string between the start and end indexes (both included).
string | |
index_start | |
index_end |
Check if a string contains a substring.
string | |
substring |
Format a number to a string with specified separator.
number | |
separator |
Returns a pointer to the last occurrence of character in the string.
string | |
character |
Check if a string starts with a substring.
string | |
prefix |
Check if a string ends with a substring.
string | |
prefix |
size_t string_position_of | ( | const string_t | string, |
const char | character | ||
) |
Returns the position (index + 1) within the string of the first occurrence of the specified substring (0 if not found).
string | |
substring |
size_t string_last_position_of | ( | const string_t | string, |
const char | character | ||
) |
Returns the position (index + 1) within the string of the last occurrence of the specified substring (0 if not found).
string | |
character |
string_t string_pad_start | ( | const string_t | string, |
const string_t | pad_string, | ||
size_t | target_length | ||
) |
Pads a string
with another pad_string
(multiple times, if needed) until the resulting string reaches the target_length
. The padding is applied from the start (left) of the string.
string | The string to pad. |
pad_string | The string to pad the current string with, to the left. |
target_length |
string_t string_zero_pad | ( | uint64_t | number, |
size_t | places | ||
) |
Pad a number with zeros.
number | |
places |