charstring.h
// Copyright (c) 1999-2018 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_CHARSTRING_H
#define RUDIMENTS_CHARSTRING_H
#include <rudiments/private/charstringincludes.h>
class RUDIMENTS_DLLSPEC charstring {
public:
static size_t length(const char *string);
static size_t size(const char *string);
static bool isNullOrEmpty(const char *string);
static bool isYes(const char *string);
static bool isNo(const char *string);
static void zero(char *str, size_t len);
static char *append(char *dest, const char *source);
static char *append(char *dest, const char *source,
size_t len);
static char *append(char *dest, int64_t number);
static char *append(char *dest, uint64_t number);
static char *append(char *dest, double number);
static char *append(char *dest, double number,
uint16_t scale);
static char *append(char *dest, double number,
uint16_t precision,
uint16_t scale);
static char *copy(char *dest, const char *source);
static char *copy(char *dest,
const char *source, size_t len);
static char *copy(char *dest, size_t location,
const char *source);
static char *copy(char *dest, size_t location,
const char *source, size_t len);
static char *safeCopy(char *dest, size_t destlen,
const char *source);
static char *safeCopy(char *dest, size_t destlen,
const char *source, size_t sourcelen);
static int32_t compare(const char *str1, const char *str2);
static int32_t compare(const char *str1, const char *str2,
size_t length);
static int32_t compareIgnoringCase(const char *str1,
const char *str2);
static int32_t compareIgnoringCase(const char *str1,
const char *str2,
size_t len);
static bool inSet(const char *str, const char * const *set);
static bool inSetIgnoringCase(const char *str,
const char * const *set);
static bool contains(const char *haystack,
const char *needle);
static bool containsIgnoringCase(const char *haystack,
const char *needle);
static bool contains(const char *haystack, char needle);
static bool containsIgnoringCase(const char *haystack,
char needle);
static bool startsWith(const char *haystack,
const char *needle);
static bool endsWith(const char *haystack,
const char *needle);
static const char *findFirst(const char *haystack,
const char *needle);
static const char *findFirstIgnoringCase(
const char *haystack,
const char *needle);
static const char *findFirst(const char *haystack,
char needle);
static const char *findFirstIgnoringCase(
const char *haystack,
char needle);
static const char *findFirstOrEnd(const char *haystack,
const char *needle);
static const char *findFirstOrEndIgnoringCase(
const char *haystack,
const char *needle);
static const char *findFirstOrEnd(const char *haystack,
char needle);
static const char *findFirstOrEndIgnoringCase(
const char *haystack,
char needle);
static const char *findLast(const char *haystack,
const char *needle);
static const char *findLastIgnoringCase(
const char *haystack,
const char *needle);
static const char *findLast(const char *haystack,
char needle);
static const char *findLastIgnoringCase(
const char *haystack,
char needle);
static char *findFirst(char *haystack, const char *needle);
static char *findFirstIgnoringCase(char *haystack,
const char *needle);
static char *findFirst(char *haystack, char needle);
static char *findFirstIgnoringCase(char *haystack,
char needle);
static char *findFirstOrEnd(char *haystack,
const char *needle);
static char *findFirstOrEndIgnoringCase(char *haystack,
const char *needle);
static char *findLast(char *haystack, const char *needle);
static char *findLastIgnoringCase(char *haystack,
const char *needle);
static char *findLast(char *haystack, char needle);
static char *findLastIgnoringCase(char *haystack,
char needle);
static const char *findFirstOfSet(const char *haystack,
const char *set);
static char *findFirstOfSet(char *haystack,
const char *set);
static const char *findFirstOfSetOrEnd(
const char *haystack,
const char *set);
static char *findFirstOfSetOrEnd(
char *haystack,
const char *set);
static const char *findLastOfSet(const char *haystack,
const char *set);
static char *findLastOfSet(char *haystack,
const char *set);
static const char *findLastOfSetOrEnd(
const char *haystack,
const char *set);
static char *findLastOfSetOrEnd(
char *haystack,
const char *set);
static char *before(const char *str,
const char *delimiter);
static char *between(const char *str,
const char *start,
const char *end);
static char *after(const char *str,
const char *delimiter);
static size_t lengthContainingSet(const char *haystack,
const char *set);
static size_t lengthNotContainingSet(const char *haystack,
const char *set);
static char *duplicate(const char *str);
static char *duplicate(const char *str, size_t len);
static void upper(char *str);
static void lower(char *str);
static void capitalize(char *str);
static void rightTrim(char *str);
static void rightTrim(char *str, char character);
static void leftTrim(char *str);
static void leftTrim(char *str, char character);
static void bothTrim(char *str);
static void bothTrim(char *str, char character);
static bool strip(char *str, char character);
static bool strip(char *str1, const char *str2);
static bool stripSet(char *str1, const char *set);
static void replace(char *str,
char oldchar, char newchar);
static void replace(char *str,
const char *oldchars, char newchar);
static char *replace(const char *str,
const char *oldstr,
const char *newstr);
static char *replace(const char *str,
const char * const *oldstrset,
ssize_t *oldstrlen,
const char * const *newstrset);
static char *replace(const char *str,
regularexpression *from,
const char *to,
bool global);
static uint16_t integerLength(int16_t number);
static uint16_t integerLength(int32_t number);
static uint16_t integerLength(int64_t number);
static uint16_t integerLength(uint16_t number);
static uint16_t integerLength(uint32_t number);
static uint16_t integerLength(uint64_t number);
static bool isInteger(const char *val);
static bool isInteger(const char *val, int32_t len);
static bool isNumber(const char *val);
static bool isNumber(const char *val, int32_t len);
static char *parseNumber(int16_t number);
static char *parseNumber(uint16_t number);
static char *parseNumber(int16_t number,
uint16_t zeropadding);
static char *parseNumber(uint16_t number,
uint16_t zeropadding);
static char *parseNumber(int32_t number);
static char *parseNumber(uint32_t number);
static char *parseNumber(int32_t number,
uint16_t zeropadding);
static char *parseNumber(uint32_t number,
uint16_t zeropadding);
static char *parseNumber(int64_t number);
static char *parseNumber(uint64_t number);
static char *parseNumber(int64_t number,
uint16_t zeropadding);
static char *parseNumber(uint64_t number,
uint16_t zeropadding);
static char *parseNumber(float number);
static char *parseNumber(float number,
uint16_t scale);
static char *parseNumber(float number,
uint16_t precision,
uint16_t scale);
static char *parseNumber(double number);
static char *parseNumber(double number,
uint16_t scale);
static char *parseNumber(double number,
uint16_t precision,
uint16_t scale);
static char *parseNumber(long double number);
static char *parseNumber(long double number,
uint16_t scale);
static char *parseNumber(long double number,
uint16_t precision,
uint16_t scale);
static int64_t toInteger(const char *string);
static int64_t toInteger(const char *string,
const char **endptr);
static int64_t toInteger(const char *string, int32_t base);
static int64_t toInteger(const char *string,
const char **endptr, int32_t base);
static uint64_t toUnsignedInteger(const char *string);
static uint64_t toUnsignedInteger(const char *string,
const char **endptr);
static uint64_t toUnsignedInteger(const char *string,
int32_t base);
static uint64_t toUnsignedInteger(const char *string,
const char **endptr,
int32_t base);
static long double toFloat(const char *string);
static long double toFloatC(const char *string);
static long double toFloat(const char *string,
const char **endptr);
static int64_t convertAmount(const char *amount);
static char *convertAmount(int64_t amount);
static char *convertAmount(int64_t amount,
uint16_t padding);
static char *httpEscape(const char *input);
static char *httpUnescape(const char *input);
static char *escape(const char *input,
const char *characters);
static char *unescape(const char *input);
static void escape(const char *input,
uint64_t inputlength,
char **output,
uint64_t *outputlength,
const char *characters);
static void unescape(const char *input,
uint64_t inputlength,
char **output,
uint64_t *outputlength);
static char *base64Encode(const unsigned char *input);
static char *base64Encode(const unsigned char *input,
uint64_t inputsize);
static void base64Encode(const unsigned char *input,
uint64_t inputsize,
char **output,
uint64_t *outputlength);
static unsigned char *base64Decode(const char *input);
static unsigned char *base64Decode(const char *input,
uint64_t inputlength);
static void base64Decode(const char *input,
uint64_t inputlength,
unsigned char **output,
uint64_t *outputsize);
static char *quotedPrintableEncode(
const unsigned char *input);
static char *quotedPrintableEncode(
const unsigned char *input,
uint64_t inputsize);
static void quotedPrintableEncode(
const unsigned char *input,
uint64_t inputsize,
char **output,
uint64_t *outputlength);
static unsigned char *quotedPrintableDecode(
const char *input);
static unsigned char *quotedPrintableDecode(
const char *input,
uint64_t inputlength);
static void quotedPrintableDecode(const char *input,
uint64_t inputlength,
unsigned char **output,
uint64_t *outputsize);
static char *hexEncode(const unsigned char *input);
static char *hexEncode(const unsigned char *input,
uint64_t inputsize);
static void hexEncode(const unsigned char *input,
uint64_t inputsize,
char **output,
uint64_t *outputlength);
static unsigned char *hexDecode(const char *input);
static unsigned char *hexDecode(const char *input,
uint64_t inputlength);
static void hexDecode(const char *input,
uint64_t inputlength,
unsigned char **output,
uint64_t *outputsize);
static void obfuscate(char *str);
static void deobfuscate(char *str);
static void leftJustify(char *str, int32_t len);
static void rightJustify(char *str, int32_t len);
static void center(char *str, int32_t len);
static char *pad(const char *string,
char padchar,
int16_t direction,
uint64_t totallength);
static void split(const char *string,
ssize_t stringlength,
const char *delimiter,
ssize_t delimiterlength,
bool collapse,
char ***list,
uint64_t *listlength);
static void split(const char *string,
const char *delimiter,
ssize_t delimiterlength,
bool collapse,
char ***list,
uint64_t *listlength);
static void split(const char *string,
ssize_t stringlength,
const char *delimiter,
bool collapse,
char ***list,
uint64_t *listlength);
static void split(const char *string,
const char *delimiter,
bool collapse,
char ***list,
uint64_t *listlength);
static char *subString(const char *str,
size_t start, size_t end);
static char *subString(const char *str, size_t start);
static char *insertString(const char *dest,
const char *src,
uint64_t index);
static ssize_t printf(char *buffer, size_t len,
const char *format, ...);
static ssize_t printf(char *buffer, size_t len,
const char *format,
va_list *argp);
static ssize_t printf(char **buffer,
const char *format, ...);
static ssize_t printf(char **buffer,
const char *format,
va_list *argp);
#include <rudiments/private/charstring.h>
};
#endif
character
Definition: character.h:11
charstring
Definition: charstring.h:16
charstring::findFirstOrEnd
static const char * findFirstOrEnd(const char *haystack, char needle)
charstring::parseNumber
static char * parseNumber(float number, uint16_t scale)
charstring::subString
static char * subString(const char *str, size_t start, size_t end)
charstring::duplicate
static char * duplicate(const char *str, size_t len)
charstring::isNumber
static bool isNumber(const char *val)
charstring::quotedPrintableDecode
static void quotedPrintableDecode(const char *input, uint64_t inputlength, unsigned char **output, uint64_t *outputsize)
charstring::leftTrim
static void leftTrim(char *str, char character)
charstring::replace
static void replace(char *str, const char *oldchars, char newchar)
charstring::parseNumber
static char * parseNumber(int16_t number)
charstring::hexDecode
static unsigned char * hexDecode(const char *input)
charstring::split
static void split(const char *string, ssize_t stringlength, const char *delimiter, bool collapse, char ***list, uint64_t *listlength)
charstring::split
static void split(const char *string, ssize_t stringlength, const char *delimiter, ssize_t delimiterlength, bool collapse, char ***list, uint64_t *listlength)
charstring::endsWith
static bool endsWith(const char *haystack, const char *needle)
charstring::append
static char * append(char *dest, uint64_t number)
charstring::safeCopy
static char * safeCopy(char *dest, size_t destlen, const char *source)
charstring::findFirst
static const char * findFirst(const char *haystack, const char *needle)
charstring::containsIgnoringCase
static bool containsIgnoringCase(const char *haystack, const char *needle)
charstring::parseNumber
static char * parseNumber(int64_t number, uint16_t zeropadding)
charstring::parseNumber
static char * parseNumber(int32_t number, uint16_t zeropadding)
charstring::copy
static char * copy(char *dest, const char *source, size_t len)
charstring::upper
static void upper(char *str)
charstring::center
static void center(char *str, int32_t len)
charstring::findFirstOrEndIgnoringCase
static const char * findFirstOrEndIgnoringCase(const char *haystack, char needle)
charstring::findFirstIgnoringCase
static const char * findFirstIgnoringCase(const char *haystack, char needle)
charstring::isYes
static bool isYes(const char *string)
charstring::split
static void split(const char *string, const char *delimiter, ssize_t delimiterlength, bool collapse, char ***list, uint64_t *listlength)
charstring::replace
static char * replace(const char *str, const char *const *oldstrset, ssize_t *oldstrlen, const char *const *newstrset)
charstring::length
static size_t length(const char *string)
charstring::parseNumber
static char * parseNumber(uint32_t number, uint16_t zeropadding)
charstring::toUnsignedInteger
static uint64_t toUnsignedInteger(const char *string, const char **endptr)
charstring::findLastIgnoringCase
static const char * findLastIgnoringCase(const char *haystack, char needle)
charstring::parseNumber
static char * parseNumber(uint32_t number)
charstring::rightTrim
static void rightTrim(char *str)
charstring::findLastOfSetOrEnd
static const char * findLastOfSetOrEnd(const char *haystack, const char *set)
charstring::parseNumber
static char * parseNumber(long double number, uint16_t scale)
charstring::rightJustify
static void rightJustify(char *str, int32_t len)
charstring::insertString
static char * insertString(const char *dest, const char *src, uint64_t index)
charstring::integerLength
static uint16_t integerLength(int64_t number)
charstring::convertAmount
static char * convertAmount(int64_t amount)
charstring::base64Encode
static char * base64Encode(const unsigned char *input)
charstring::replace
static char * replace(const char *str, const char *oldstr, const char *newstr)
charstring::toUnsignedInteger
static uint64_t toUnsignedInteger(const char *string)
charstring::bothTrim
static void bothTrim(char *str, char character)
charstring::findFirstIgnoringCase
static char * findFirstIgnoringCase(char *haystack, const char *needle)
charstring::parseNumber
static char * parseNumber(float number)
charstring::printf
static ssize_t printf(char **buffer, const char *format,...)
charstring::findLastOfSet
static const char * findLastOfSet(const char *haystack, const char *set)
charstring::safeCopy
static char * safeCopy(char *dest, size_t destlen, const char *source, size_t sourcelen)
charstring::startsWith
static bool startsWith(const char *haystack, const char *needle)
charstring::parseNumber
static char * parseNumber(uint16_t number, uint16_t zeropadding)
charstring::hexDecode
static void hexDecode(const char *input, uint64_t inputlength, unsigned char **output, uint64_t *outputsize)
charstring::hexEncode
static void hexEncode(const unsigned char *input, uint64_t inputsize, char **output, uint64_t *outputlength)
charstring::parseNumber
static char * parseNumber(int32_t number)
charstring::convertAmount
static int64_t convertAmount(const char *amount)
charstring::findLastIgnoringCase
static char * findLastIgnoringCase(char *haystack, const char *needle)
charstring::hexEncode
static char * hexEncode(const unsigned char *input, uint64_t inputsize)
charstring::toUnsignedInteger
static uint64_t toUnsignedInteger(const char *string, const char **endptr, int32_t base)
charstring::findLastIgnoringCase
static const char * findLastIgnoringCase(const char *haystack, const char *needle)
charstring::toInteger
static int64_t toInteger(const char *string, const char **endptr, int32_t base)
charstring::parseNumber
static char * parseNumber(uint16_t number)
charstring::leftTrim
static void leftTrim(char *str)
charstring::quotedPrintableDecode
static unsigned char * quotedPrintableDecode(const char *input, uint64_t inputlength)
charstring::findLastOfSet
static char * findLastOfSet(char *haystack, const char *set)
charstring::findFirstOfSetOrEnd
static const char * findFirstOfSetOrEnd(const char *haystack, const char *set)
charstring::printf
static ssize_t printf(char *buffer, size_t len, const char *format, va_list *argp)
charstring::append
static char * append(char *dest, double number, uint16_t precision, uint16_t scale)
charstring::rightTrim
static void rightTrim(char *str, char character)
charstring::findFirst
static char * findFirst(char *haystack, const char *needle)
charstring::isNullOrEmpty
static bool isNullOrEmpty(const char *string)
charstring::subString
static char * subString(const char *str, size_t start)
charstring::append
static char * append(char *dest, const char *source)
charstring::lower
static void lower(char *str)
charstring::contains
static bool contains(const char *haystack, char needle)
charstring::compareIgnoringCase
static int32_t compareIgnoringCase(const char *str1, const char *str2, size_t len)
charstring::append
static char * append(char *dest, int64_t number)
charstring::isInteger
static bool isInteger(const char *val)
charstring::quotedPrintableEncode
static void quotedPrintableEncode(const unsigned char *input, uint64_t inputsize, char **output, uint64_t *outputlength)
charstring::findLast
static const char * findLast(const char *haystack, const char *needle)
charstring::strip
static bool strip(char *str, char character)
charstring::quotedPrintableEncode
static char * quotedPrintableEncode(const unsigned char *input, uint64_t inputsize)
charstring::escape
static void escape(const char *input, uint64_t inputlength, char **output, uint64_t *outputlength, const char *characters)
charstring::parseNumber
static char * parseNumber(double number, uint16_t precision, uint16_t scale)
charstring::findFirstIgnoringCase
static char * findFirstIgnoringCase(char *haystack, char needle)
charstring::parseNumber
static char * parseNumber(int64_t number)
charstring::findFirstIgnoringCase
static const char * findFirstIgnoringCase(const char *haystack, const char *needle)
charstring::toFloatC
static long double toFloatC(const char *string)
charstring::stripSet
static bool stripSet(char *str1, const char *set)
charstring::contains
static bool contains(const char *haystack, const char *needle)
charstring::bothTrim
static void bothTrim(char *str)
charstring::base64Decode
static unsigned char * base64Decode(const char *input, uint64_t inputlength)
charstring::findFirstOrEndIgnoringCase
static const char * findFirstOrEndIgnoringCase(const char *haystack, const char *needle)
charstring::compare
static int32_t compare(const char *str1, const char *str2, size_t length)
charstring::toFloat
static long double toFloat(const char *string)
charstring::httpUnescape
static char * httpUnescape(const char *input)
charstring::escape
static char * escape(const char *input, const char *characters)
charstring::findLastOfSetOrEnd
static char * findLastOfSetOrEnd(char *haystack, const char *set)
charstring::leftJustify
static void leftJustify(char *str, int32_t len)
charstring::toFloat
static long double toFloat(const char *string, const char **endptr)
charstring::parseNumber
static char * parseNumber(long double number, uint16_t precision, uint16_t scale)
charstring::toInteger
static int64_t toInteger(const char *string)
charstring::integerLength
static uint16_t integerLength(uint16_t number)
charstring::toInteger
static int64_t toInteger(const char *string, int32_t base)
charstring::base64Decode
static unsigned char * base64Decode(const char *input)
charstring::zero
static void zero(char *str, size_t len)
charstring::pad
static char * pad(const char *string, char padchar, int16_t direction, uint64_t totallength)
charstring::base64Encode
static void base64Encode(const unsigned char *input, uint64_t inputsize, char **output, uint64_t *outputlength)
charstring::append
static char * append(char *dest, double number, uint16_t scale)
charstring::findLastIgnoringCase
static char * findLastIgnoringCase(char *haystack, char needle)
charstring::isNo
static bool isNo(const char *string)
charstring::between
static char * between(const char *str, const char *start, const char *end)
charstring::replace
static char * replace(const char *str, regularexpression *from, const char *to, bool global)
charstring::capitalize
static void capitalize(char *str)
charstring::printf
static ssize_t printf(char *buffer, size_t len, const char *format,...)
charstring::integerLength
static uint16_t integerLength(uint64_t number)
charstring::findLast
static char * findLast(char *haystack, char needle)
charstring::isNumber
static bool isNumber(const char *val, int32_t len)
charstring::printf
static ssize_t printf(char **buffer, const char *format, va_list *argp)
charstring::findFirstOrEnd
static const char * findFirstOrEnd(const char *haystack, const char *needle)
charstring::lengthNotContainingSet
static size_t lengthNotContainingSet(const char *haystack, const char *set)
charstring::inSetIgnoringCase
static bool inSetIgnoringCase(const char *str, const char *const *set)
charstring::findFirstOfSetOrEnd
static char * findFirstOfSetOrEnd(char *haystack, const char *set)
charstring::toInteger
static int64_t toInteger(const char *string, const char **endptr)
charstring::hexDecode
static unsigned char * hexDecode(const char *input, uint64_t inputlength)
charstring::size
static size_t size(const char *string)
charstring::unescape
static char * unescape(const char *input)
charstring::unescape
static void unescape(const char *input, uint64_t inputlength, char **output, uint64_t *outputlength)
charstring::quotedPrintableEncode
static char * quotedPrintableEncode(const unsigned char *input)
charstring::findFirstOrEnd
static char * findFirstOrEnd(char *haystack, const char *needle)
charstring::replace
static void replace(char *str, char oldchar, char newchar)
charstring::compare
static int32_t compare(const char *str1, const char *str2)
charstring::split
static void split(const char *string, const char *delimiter, bool collapse, char ***list, uint64_t *listlength)
charstring::parseNumber
static char * parseNumber(long double number)
charstring::findLast
static const char * findLast(const char *haystack, char needle)
charstring::parseNumber
static char * parseNumber(int16_t number, uint16_t zeropadding)
charstring::inSet
static bool inSet(const char *str, const char *const *set)
charstring::deobfuscate
static void deobfuscate(char *str)
charstring::after
static char * after(const char *str, const char *delimiter)
charstring::findFirst
static char * findFirst(char *haystack, char needle)
charstring::findFirstOrEndIgnoringCase
static char * findFirstOrEndIgnoringCase(char *haystack, const char *needle)
charstring::findFirstOfSet
static char * findFirstOfSet(char *haystack, const char *set)
charstring::findFirst
static const char * findFirst(const char *haystack, char needle)
charstring::parseNumber
static char * parseNumber(double number, uint16_t scale)
charstring::strip
static bool strip(char *str1, const char *str2)
charstring::duplicate
static char * duplicate(const char *str)
charstring::integerLength
static uint16_t integerLength(int16_t number)
charstring::base64Decode
static void base64Decode(const char *input, uint64_t inputlength, unsigned char **output, uint64_t *outputsize)
charstring::append
static char * append(char *dest, double number)
charstring::compareIgnoringCase
static int32_t compareIgnoringCase(const char *str1, const char *str2)
charstring::append
static char * append(char *dest, const char *source, size_t len)
charstring::containsIgnoringCase
static bool containsIgnoringCase(const char *haystack, char needle)
charstring::findFirstOfSet
static const char * findFirstOfSet(const char *haystack, const char *set)
charstring::parseNumber
static char * parseNumber(double number)
charstring::integerLength
static uint16_t integerLength(int32_t number)
charstring::toUnsignedInteger
static uint64_t toUnsignedInteger(const char *string, int32_t base)
charstring::obfuscate
static void obfuscate(char *str)
charstring::copy
static char * copy(char *dest, const char *source)
charstring::parseNumber
static char * parseNumber(float number, uint16_t precision, uint16_t scale)
charstring::findLast
static char * findLast(char *haystack, const char *needle)
charstring::convertAmount
static char * convertAmount(int64_t amount, uint16_t padding)
charstring::copy
static char * copy(char *dest, size_t location, const char *source, size_t len)
charstring::httpEscape
static char * httpEscape(const char *input)
charstring::integerLength
static uint16_t integerLength(uint32_t number)
charstring::before
static char * before(const char *str, const char *delimiter)
charstring::parseNumber
static char * parseNumber(uint64_t number)
charstring::quotedPrintableDecode
static unsigned char * quotedPrintableDecode(const char *input)
charstring::isInteger
static bool isInteger(const char *val, int32_t len)
charstring::hexEncode
static char * hexEncode(const unsigned char *input)
charstring::copy
static char * copy(char *dest, size_t location, const char *source)
charstring::base64Encode
static char * base64Encode(const unsigned char *input, uint64_t inputsize)
charstring::lengthContainingSet
static size_t lengthContainingSet(const char *haystack, const char *set)
charstring::parseNumber
static char * parseNumber(uint64_t number, uint16_t zeropadding)
input
Definition: input.h:9
output
Definition: output.h:9
regularexpression
Definition: regularexpression.h:14