29 #ifndef REGIFY_UTIL_STRING_H
30 #define REGIFY_UTIL_STRING_H
165 #define ruUtf8NoCase 0
170 #define ruUtf8Lower 1
175 #define ruUtf8Upper 2
743 #define ruBufferNew(initialSize) (ruBuffer) ruStringNewn(NULL, initialSize)
752 #define ruBufferAppend(rb, buf, len) ruStringAppendn(rb, buf, len)
768 #define ruBufferGetData(rb) ruStringGetCString(rb)
776 #define ruBufferLen(rb, code) ruStringLen(rb, code)
783 #define ruBufferFree(rb, keep) ruStringFree(rb, keep);
void * ruBuffer
An opaque data type representing a regify-util string object that is not NULL terminated.
Definition: string.h:732
RUAPI int32_t ruBufferAppendUriEncoded(ruString rs, const char *buf, rusize len)
Append given string URI encoded to String Object.
void * ruList
Opaque pointer to list object. See List Collection.
Definition: list.h:103
uint16_t * alloc_uni
An allocated UTF16 wchar_t character type.
Definition: regify-util.h:233
const uint16_t * trans_uni
A transient UTF16 wchar_t character type.
Definition: regify-util.h:220
const char * trans_chars
A transient NULL terminated string pointer.
Definition: regify-util.h:186
const char * perm_chars
A permanent NULL terminated string pointer.
Definition: regify-util.h:176
char * alloc_chars
An allocated NULL terminated string pointer.
Definition: regify-util.h:199
size_t rusize
Abstracted version of size_t.
Definition: regify-util.h:338
RUAPI int32_t ruStringAppend(ruString rs, const char *str)
Append given string to String Object.
RUAPI int32_t ruStringReset(ruString rs)
Empties the string for reuse without freeing the buffer.
RUAPI int32_t ruStringAppendUriEncoded(ruString rs, const char *instr)
Append given string URI encoded to String Object.
RUAPI bool ruStringEndsWith(ruString rs, const char *suffix, int32_t *code)
Whether String Object ends with given suffix.
RUAPI char * ruStringGetCString(ruString rs)
Returns the underlying char* of the given String Object.
void * ruString
An opaque data type representing a regify-util string object.
Definition: string.h:45
RUAPI rusize ruStringLen(ruString rs, int32_t *code)
Returns the current length of the String Object.
RUAPI ruString ruStringNewn(const char *instr, rusize size)
Creates a new String object of initial size from a string.
RUAPI ruString ruStringFree(ruString rs, bool keepBuffer)
Frees the given String Object object.
RUAPI int32_t ruStringAppendf(ruString rs, const char *format,...)
Appends formatted string to String Object.
RUAPI ruString ruStringNewf(const char *format,...)
Creates a new String object from a formatted string.
RUAPI ruString ruStringNew(const char *instr)
Creates a new String object from a string.
RUAPI int32_t ruStringAppendn(ruString rs, const char *instr, rusize len)
Append given string to String Object.
RUAPI trans_chars ruStrTrimBounds(trans_chars inStart, rusize inLen, rusize *outLen)
Returns the white space trimmed bounds of given string without modifying it.
RUAPI alloc_uni ruStrNToUtf16(trans_chars str, int32_t bytelen)
Converts given UTF8 string to UTF16 as it is used on Windows.
RUAPI bool ruStrCaseEquals(trans_chars str1, trans_chars str2)
Returns true when libc strcasecmp would return 0 but in a manner that gracefully handles NULL imputs.
RUAPI alloc_chars ruStrReplace(trans_chars instr, trans_chars search, trans_chars replace)
Replaces any occurrence of search in instr with replace.
RUAPI char * ruDupvPrintf(const char *format, va_list arglist)
Returns an allocated string from given vprintf call.
RUAPI alloc_chars ruStrFromUtf16(trans_uni unistr)
Converts given UTF16 wide character sequence to UTF8.
ruTrimSide
Definition: string.h:630
RUAPI char ruAsciiCharToUpper(char in)
Returns uppercase representation of given ASCII character.
RUAPI int32_t ruStrCaseCmp(trans_chars str1, trans_chars str2)
Returns what libc strcasecmp would return but in a manner that gracefully handles NULL imputs.
RUAPI perm_chars ruStrTrim(perm_chars instr, trans_chars unwanted, enum ruTrimSide ends, alloc_chars *newstr)
Checks given string for leading / trailing unwanted characters and returns trimmed copy if needed.
RUAPI long ruStrToLong(trans_chars str)
Like ruStrParseLong but ignores overflow and trailing garbage.
RUAPI trans_chars ruStrStrLen(trans_chars haystack, trans_chars needle, rusize len)
Searches the first instance of needle in haystack up to len bytes.
RUAPI char * ruStrDup(const char *str)
Returns a copy of given string.
RUAPI ruList ruStrSplit(trans_chars instr, trans_chars delim, int32_t maxCnt)
split given instr with delim into a ruList.
RUAPI alloc_chars ruAsciiNToLower(trans_chars instr, rusize len)
Returns a lowercase copy of len bytes of given ASCII string.
RUAPI perm_chars ruStrStrip(perm_chars instr, trans_chars unwanted, alloc_chars *newstr)
Removes unwanted characters from instr.
RUAPI bool ruStrEquals(trans_chars str1, trans_chars str2)
Returns true when libc strcmp would return 0 but in a manner that gracefully handles NULL imputs.
RUAPI bool ruStrStartsWith(trans_chars str, trans_chars prefix, int32_t *code)
Whether given string starts with given prefix.
RUAPI bool ruIsBool(trans_chars str, bool *val)
Returns true if given string contains a valid boolean.
RUAPI trans_chars ruStrCaseStrLen(trans_chars haystack, trans_chars needle, rusize len)
Searches the first instance of lowercase needle in lowercase haystack up to len bytes....
RUAPI alloc_chars ruUtf8ToUpper(trans_chars instr)
Returns a uppercase copy of given UTF8 string.
RUAPI int64_t ruStrToInt64(trans_chars str)
Like ruStrParseInt64 but ignores overflow and trailing garbage.
RUAPI char * ruUtf8CaseNormalize(const char *instr, int32_t normMode, int32_t caseMode)
Returns the given string normalized and/or case switched as requested.
RUAPI trans_chars ruLastSubStr(trans_chars haystack, trans_chars needle)
Searches the last instance of needle in haystack.
RUAPI bool ruStrEndsWith(trans_chars str, trans_chars suffix, int32_t *code)
Whether given string ends with given suffix.
RUAPI trans_chars ruLastSubStrLen(trans_chars haystack, trans_chars needle, rusize len)
Searches the last instance of needle in haystack up to len bytes.
RUAPI bool ruStrEmpty(trans_chars str)
Checks whether given string has any content other than whitespace.
RUAPI int32_t ruStrParseInt(trans_chars str, perm_chars *endptr, uint32_t base, int32_t *num)
RUAPI alloc_chars ruUtf8ToLower(trans_chars instr)
Returns a lowercase copy of given UTF8 string.
RUAPI alloc_chars ruAsciiToUpper(trans_chars instr)
Returns a uppercase copy of given ASCII string.
RUAPI int32_t ruStrParseLong(trans_chars str, perm_chars *endptr, uint32_t base, long *num)
RUAPI trans_chars ruStrStr(trans_chars haystack, trans_chars needle)
Searches the first instance of needle in haystack.
RUAPI ruList ruStrNSplit(trans_chars instr, rusize inlen, trans_chars delim, int32_t maxCnt)
Split given instr up to inlen bytes with delim into a ruList.
RUAPI bool ruStrHasChar(trans_chars haystack, char needle)
RUAPI bool ruStrFindKeyVal(trans_chars inStart, rusize inLen, trans_chars delim, trans_chars *keyStart, rusize *keyLen, trans_chars *valStart, rusize *valLen)
Parses whitespace trimmed key / value regions based on delim out of given input string.
RUAPI int32_t ruStrParseInt64(trans_chars str, perm_chars *endptr, uint32_t base, int64_t *num)
RUAPI int32_t ruStrParseBool(trans_chars str, perm_chars *endptr, bool *out)
Parses boolean value out of given string.
RUAPI alloc_chars ruAsciiToLower(trans_chars instr)
Returns a lowercase copy of given ASCII string.
RUAPI bool ruStrCaseStartsWith(trans_chars str, trans_chars prefix, int32_t *code)
Whether given string starts with given prefix ignoring case.
RUAPI alloc_chars ruAsciiNToUpper(trans_chars instr, rusize len)
Returns a uppercase copy of len bytes of given ASCII string.
RUAPI char * ruStrNDup(const char *str, rusize len)
Returns a copy of len bytes of given string.
RUAPI void ruStrByteReplace(char *string, char search, char replace)
Replaces any occurrence of search in string with replace.
RUAPI bool ruStrCaseEndsWith(trans_chars str, trans_chars suffix, int32_t *code)
Whether given string ends with given suffix ignoring case.
RUAPI char * ruDupPrintf(const char *format,...)
Returns an allocated string from given printf call.
RUAPI alloc_chars ruStrToNfd(trans_chars instr)
Returns the given string in decomposed form.
RUAPI int32_t ruStrToInt(trans_chars str)
Like ruStrParseInt but ignores overflow and trailing garbage.
RUAPI alloc_chars ruStrFromNUtf16(trans_uni unistr, int32_t bytelen)
Converts given UTF16 wide character sequence to UTF8.
RUAPI rusize ruStrLen(trans_chars str)
behaves like strlen but returns 0 if NULL is passed in
RUAPI char ruAsciiCharToLower(char in)
Returns lowercase representation of given ASCII character.
RUAPI alloc_chars ruStrFromNfd(trans_chars instr)
Returns the given decomposed string in precomposed form.
RUAPI bool ruStrNEquals(trans_chars str1, rusize s1len, trans_chars str2)
Returns true when str2 is equal to the first len number of bytes in str1 or both str1 and str2 are NU...
RUAPI bool ruIsInt64(trans_chars str)
Returns true if given string contains a valid 64 bit integer.
RUAPI int32_t ruStrCmp(trans_chars str1, trans_chars str2)
Returns what libc strcmp would return but in a manner that gracefully handles NULL imputs.
RUAPI alloc_uni ruStrToUtf16(trans_chars str)
Converts given UTF8 string to UTF16 as it is used on Windows.
@ ruTrimStart
Definition: string.h:639
@ ruTrimEnd
Definition: string.h:644
@ ruTrimBoth
Definition: string.h:634