Skip to content

API Reference

Classes

Name Description
StringArr The StringArr struct, contains an array of strings and the variable holding the number of strings in the array.

Functions


StringToLower

void StringToLower(char * s)

Converts an input string s in place to all lowercase.

Parameters

Parameter Type Description
s char * The input string.

StringToUpper

void StringToUpper(char * s)

Converts an input string s in place to all uppercase.

Parameters

Parameter Type Description
s char * The input string.

IsCharInString

bool IsCharInString(const char * input_str, char checker)

Checks a string for a specific character.

Returns

true if the character is present, false if not.

Parameters

Parameter Type Description
input_str const char * The input string.
checker char The character to check.

NumCharInString

size_t NumCharInString(const char * input_str, char checker)

Checks a string for a specific character and returns the number of occurences.

Returns

The number of occurences.

Parameters

Parameter Type Description
input_str const char * The input string.
checker char The character to check.

PutQuotesAroundString

char * PutQuotesAroundString(char * input_str, bool free_input)

Puts Quotes around a string and returns the new string.

Returns

The new string with quotes around it.

Parameters

Parameter Type Description
input_str char * The string to duplicate and change.
free_input bool If true, will free the input_str for convience

GetEnv

const char * GetEnv(char * name, char * fallback)

Looks up an environment variable with an optional fallback.

Returns

A string of the environment variable.

Parameters

Parameter Type Description
name char * The name of the environment variable to look up.
fallback char * The fallback default if the environment variable couldn't be found.

EveryoneExplodeNow

StringArr * EveryoneExplodeNow(char * input_str, char delim)

Creates a StringArr based on an input string and a delimiter. For example, [EveryoneExplodeNow](#everyoneexplodenow)("hello world", ' ') will return ["hello", "world"].

Returns

The StringArr

Parameters

Parameter Type Description
input_str char * The input string.
delim char What character to break the string about from.

EveryoneExplodeNowHandleQuotes

StringArr * EveryoneExplodeNowHandleQuotes(char * input_str, char delim, char quotes_char)

Creates a StringArr based on an input string and a delimiter. For example, [EveryoneExplodeNow](#everyoneexplodenow)("hello world", ' ') will return ["hello", "world"] but also handle quotes, so delim characters in quotes will not be exploded.

Returns

The StringArr

Parameters

Parameter Type Description
input_str char * The input string.
delim char What character to break the string about from.
quotes_char char Which quote character to ignore from.

FreeStringArr

void FreeStringArr(StringArr * string_arr)

Free all Strings inside a StringArr and the StringArr itself.

Parameters

Parameter Type Description
string_arr StringArr * The StringArr to free.

PrintStringArr

void PrintStringArr(StringArr * string_arr)

Pretty Print a StringArr for debugging.

Parameters

Parameter Type Description
string_arr StringArr * The StringArr to print.

StringArr

#include <standardloop/util.h>
struct StringArr

The StringArr struct, contains an array of strings and the variable holding the number of strings in the array.

Public Attributes

Return Name Description
int num_strings The number of strings in the array.
char ** strings The array of strings.

num_strings

int num_strings

The number of strings in the array.


strings

char ** strings

The array of strings.