Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
Go to the documentation of this file.
26 #ifndef STRING_UTILS_H
27 #define STRING_UTILS_H
216 GRASSROOTS_UTIL_API char *
GetNextToken (
const char **start_pp,
const char *delimiters_p,
const bool check_for_whitespace_flag,
const bool update_position_flag);
char * ConcatenateVarargsStrings(const char *value_s,...)
Concatenate a va_list of strings.
bool GetLineFromFile(FILE *in_f, char **buffer_pp)
Read a line from a file with no buffer overflow issues.
void ReplaceChars(char *value_s, char old_data, char new_data)
Replace each instance of a character within a string with another.
LinkedList * ParseStringToIntLinkedList(const char *const format_p, const char *const delimiters_p)
Parse the format string and sort out into a linked list of IntListNodes holding the tokens as numbers...
LinkedList * ParseStringToDataLinkedList(const char *const format_p, const char *const delimiters_p)
Parse the format string and sort out into a linked list of IntListNodes holding the tokens as numbers...
char * GetNextToken(const char **start_pp, const char *delimiters_p, const bool check_for_whitespace_flag, const bool update_position_flag)
Get a copy of the next word from a buffer.
int Strnicmp(const char *c0_s, const char *c1_s, size_t length)
Do a case-insensitive comparison between the initial portions of two strings.
void NullifyTrailingZeroes(char *numeric_string_p)
Format a string containing a number by removing all of its trailing zeroes, e.g.
char * GetFileContentsAsStringByFilename(const char *filename_s)
Get the contents of FILE as c-style string.
int Stricmp(const char *c0_s, const char *c1_s)
Do a case-insensitive comparison between two strings.
void FreeCopiedString(char *str_p)
Delete a string previously allocated using CopyToNewString.
bool SearchAndReplaceInString(const char *src_s, char **dest_ss, const char *to_replace_s, const char *with_s)
bool GetKeyValuePair(char *line_p, char **key_pp, char **value_pp, const char comment_identifier)
Get and make copies of two strings from a line of the format.
bool IsStringEmpty(const char *value_s)
Test whether a string is NULL or contains just whitespace.
bool CloneValidString(const char *src_s, char **dest_ss)
Clone a valid string to a destination string pointer.
bool DoesStringContainWhitespace(const char *value_s)
Test whether a given string contains any whitespace characters.
const char * Stristr(const char *value_s, const char *substring_s)
Find a substring within a string.
char * Strrstr(const char *haystack_s, const char *needle_s)
Find the last occurence of a substring within a string.
char * GetFileContentsAsString(FILE *input_f)
Get the contents of FILE as c-style string.
void FreeToken(char *token_s)
Free a c-style string that has been returned by GetNextToken.
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
char * CopyToNewString(const char *const src_p, const size_t length_to_copy, bool trim)
Copy a string to a newly created string.
void FreeStringArray(char **values_ss, const size_t num_values)
bool ReplaceStringValue(char **dest_ss, const char *const src_s)
Make a copy of a string.
bool DoesStringStartWith(const char *value_s, const char *start_s)
char * GetStringAsLowerCase(const char *value_s)
char * ConcatenateStrings(const char *const first_s, const char *const second_s)
Get a newly created string that is the concatenation of two others.
bool DoesStringEndWith(const char *value_s, const char *ending_s)
LinkedList * ParseStringToStringLinkedList(const char *const format_p, const char *const delimiters_p, const bool treat_whitespace_as_delimiter_flag)
Parse the format string and sort out into a linked list of tokens.
void ReplaceCharacter(char *value_s, const char char_to_replace, const char replacement_char)
Replace all instances of a character by another within a string.
uint32 HashString(const void *const key_p)
Create a numeric value for suitable for hashing from a given string.
bool CopyAndAddStringValue(const char *const src_s, char **dest_ss)
void FreeLineBuffer(char *buffer_p)
Free a buffer that has been allocated with GetLineFromFile.
char * RemoveStartingAndTrailingWhitespace(const char *value_s)
bool DoStringsMatch(const char *const val_0_s, const char *const val_1_s)
#define GRASSROOTS_UTIL_API
Definition: grassroots_util_library.h:47
char * EasyCopyToNewString(const char *const src_s)
Copy a string to a newly created string.