Rudiments
|
#include <charstring.h>
The charstring class provides static methods for manipulating C-style character strings.
In addition to some unique methods, analogs for the standard C string functions are provided. However, unlike the standard C string functions, the charstring methods are NULL safe. Your application will not crash if a NULL is passed in, and instead, will give intuitive results.
Note that meny method of this class expect to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Appends "source" to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
Appends "len" characters of "source" to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
|
static |
Converts "number" to a string using "precision" and "scale" and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
Converts "number" to a string using "scale" and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".
base64-decodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to base64Decode above but only decodes the first "inputlen" characters of "input"
|
static |
similar to base64Decode() above, but returns the result in "output" and "outputsize" (in bytes) rather than in a return value
base64-encodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to base64Encode above but only encodes the first "inputsize" bytes of "input"
|
static |
similar to base64Encode() above, but returns the result in "output" and "outputlen" (in characters) rather than in a return value
Trims all characters off of both sides of "str".
Captitalizes "str", converting characters to upper or lower case as necessary.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Centers the text of "str" for "len" characters.
Example: "hello " -> " hello "
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2".
Returns -1,0 or 1 if "len" characters of "str1" are greater than, equal to or less than "len" characters of "str2".
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2", ignoring case.
|
static |
Returns -1,0 or 1 if "len" characters of "str1" are greater than, equal to or less than "len" characters of "str2", ignoring case.
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2".
Embedded (version) numbers will be interpreted "naturally" (eg. 12 > 8)
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
|
static |
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2".
Embedded (version) numbers will be interpreted "naturally" (eg. 12 > 8)
"delimiters" should be set to the set of characters that will be interpreted as equivalent delimiters. Eg. "._" means that either .'s or _'s may be used to delimit numbers.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2", where "str1" and "str2" are version numbers with arbitrary numbers of decimal delimiters.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
|
static |
Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2", where "str1" and "str2" are version numbers with arbitrary numbers of delimiters.
"delimiters" should be set to the set of characters that will be interpreted as equivalent delimiters. Eg. "._" means that either .'s or _'s may be used to delimiters numbers.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
|
static |
Compares "string" to "pattern" which may contain instances of single-character wildcard markers "singlewildcard" or multi-character wildcard markers "multiwildcard".
If either "singlewildcard" or "multiwildcard" are '\0' then they are ignored.
Returns true if a match is found or false otherwise.
|
static |
Compares "string" to the first "patternlen" characters of "pattern" which may contain instances of single-character wildcard markers "singlewildcard" or multi-character wildcard markers "multiwildcard".
If either "singlewildcard" or "multiwildcard" are '\0' then they are ignored.
Returns true if a match is found or false otherwise.
|
static |
Compares the first "stringlen" characters of "string" to "pattern" which may contain instances of single-character wildcard markers "singlewildcard" or multi-character wildcard markers "multiwildcard".
If either "singlewildcard" or "multiwildcard" are '\0' then they are ignored.
Returns true if a match is found or false otherwise.
|
static |
Compares the first "stringlen" characters of "string" to the first "patternlen" characters of "pattern" which may contain instances of single-character wildcard markers "singlewildcard" or multi-character wildcard markers "multiwildcard".
If either "singlewildcard" or "multiwildcard" are '\0' then they are ignored.
Returns true if a match is found or false otherwise.
Returns true if "haystack" contains "needle" or false otherwise.
Returns true if "haystack" contains "needle" or false otherwise.
Returns true if "haystack" contains "needle", ignoring case, or false otherwise.
Returns true if "haystack" contains "needle", ignoring case, or false otherwise.
Converts "amount" which is assumed to be a dollar amount into pennies.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Converts "amount" which is assumed to be a number of pennies into a dollar amount string.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Converts "amount" which is assumed to be a number of pennies into a dollar amount string where there are "padding" places between the dollar sign and decimal point. These will be space padded if the amount is small enough not to fill them.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Converts "string" to a floating point number.
Converts "string" to a floating point number. If non-NULL, endptr will be set to the first character in the string after the number.
Converts "string" to a floating point number.
If "string" uses a "." as a decimal point (per the "C" locale) then the "." is first converted to the appropriate decimal-delimiter for the current locale.
(Currently only supported on linux/unix platforms that provide the locale.h header. On other platforms, it just falls through to convertToFloat().)
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Converts "string" to a 64-bit integer.
Converts "string" to a 64-bit integer. If non-NULL, endptr will be set to the first character in the string after the number.
|
static |
Converts "string" to a 64-bit integer of base "base". If non-NULL, endptr will be set to the first character in the string after the number.
Converts "string" to a 64-bit integer of base "base".
Converts "string" to a 64-bit unsigned integer.
|
static |
Converts "string" to a 64-bit unsigned integer. If non-NULL, endptr will be set to the first character in the string after the number.
|
static |
Converts "string" to a 64-bit unsigned integer of base "base". If non-NULL, endptr will be set to the first character in the string after the number.
Converts "string" to a 64-bit unsigned integer of base "base".
Replaces "dest" with "source". Assumes that there is enough room in "dest" to accommodate "source". Returns a pointer to "dest".
Replaces the first "len" characters of "dest" with "source". Assumes that "dest" is at least "len" characters long. Returns a pointer to "dest".
Replaces "dest" with "source", starting "location" characters into "dest". Assumes that there is enough room in "dest" (after "location" characters) to accommodate "source". Returns a pointer to "dest".
|
static |
Replaces "len" characters of "dest" with "source", starting "location" characters into "dest". Assumes that there are "len" characters in "dest" (after "location" characters). Returns a pointer to "dest".
Deobfuscates "str" which was obfusacted using the obfuscate method of this class.
Creates a duplicate of "str" and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" characters of "str" and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of "str", converting each wide character to an ASCII character, replacing characters that can't be represented in ASCII with an ASCII '?', and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of "str", converting each wide character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" wide characters of "str", converting each wide character to a character per the character set of the current locale, replacing characters that can't be represented '?', and returns a pointer to it.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" wide characters of "str", converting each wide character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of "str", converting each UCS-2 character to an ASCII character, replacing characters that can't be represented in ASCII with an ASCII '?', and returns a pointer to it.
The UCS-2 characters in "str" are presumed to be in the byte-order of the system.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of "str", converting each UCS-2 character to an ASCII character, replacing characters that can't be represented in ASCII with an ASCII '?', and returns a pointer to it.
If "bigendian" is true then "str" is presumed to be big endian. If "bigendian" is false, then "str" is presumed to be little endian.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
The UCS-2 characters in "str" are presumed to be in the byte-order of the system.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
|
static |
Creates a duplicate of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
If "bigendian" is true then "str" is presumed to be big endian. If "bigendian" is false, then "str" is presumed to be little endian.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" UCS-2 characters of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented '?', and returns a pointer to it.
The UCS-2 characters in "str" are presumed to be in the byte-order of the system.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" UCS-2 characters of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented '?', and returns a pointer to it.
If "bigendian" is true then "str" is presumed to be big endian. If "bigendian" is false, then "str" is presumed to be little endian.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Creates a duplicate of the first "len" UCS-2 characters of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
The UCS-2 characters in "str" are presumed to be in the byte-order of the system.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
|
static |
Creates a duplicate of the first "len" UCS-2 characters of "str", converting each UCS-2 character to a character per the character set of the current locale, replacing characters that can't be represented with "replacement", and returns a pointer to it.
If "bigendian" is true then "str" is presumed to be big endian. If "bigendian" is false, then "str" is presumed to be little endian.
Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.
Returns true if "haystack" ends with "needle" or false otherwise.
escapes all characters in "characters" found in "input" using \'s and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
|
static |
similar to escape() above, but takes an "inputlen" parameter and returns the result in "output" and "outputlen" rather than in a return value
|
static |
Where "string" is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
The character to interpret as a quote is determined by the first character in the string.
Note, that in the case of the first character being an open square bracket, the closing quote is set to a closing square bracket, and doubling is disabled, independent of the value of the parameter "doubling".
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string" is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
"quote" specifies the character to interpret as a quote, eg. a single-quote, double-quote, back-quote, etc. but may be any character. Note that the first character of "string" is not validated to be "quote".
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string", of length "stringlen", is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
The character to interpret as a quote is determined by the first character in the string.
Note, that in the case of the first character being an open square bracket, the closing quote is set to a closing square bracket, and doubling is disabled, independent of the value of the parameter "doubling".
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string", of length "stringlen", is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
"quote" specifies the character to interpret as a quote, eg. a single-quote, double-quote, back-quote, etc. but may be any character. Note that the first character of "string" is not validated to be "quote".
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string" is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
The character to interpret as a quote is determined by the first character in the string.
Note, that in the case of the first character being an open square bracket, the closing quote is set to a closing square bracket, and doubling is disabled, independent of the value of the parameter "doubling".
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string" is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
"quote" specifies the character to interpret as a quote, eg. a single-quote, double-quote, back-quote, etc. but may be any character. Note that the first character of "string" is not validated to be "quote".
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string", of length "stringlen", is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
The character to interpret as a quote is determined by the first character in the string.
Note, that in the case of the first character being an open square bracket, the closing quote is set to a closing square bracket, and doubling is disabled, independent of the value of the parameter "doubling".
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
|
static |
Where "string", of length "stringlen", is presumed to contain a quoted string (eg. "'hello'"), the first character of which is an opening quote, this method returns a pointer to the position in the string, immediately following the closing quote.
"quote" specifies the character to interpret as a quote, eg. a single-quote, double-quote, back-quote, etc. but may be any character. Note that the first character of "string" is not validated to be "quote".
If "backslash" is true then backslash-escaping is considered. If "doubling" is true then doubling to represent a literal quote is considered.
Returns NULL if "string" is NULL. Returns a pointer to "string" if "stringlen" is 0. If no closing quote is found then it returns a pointer to the end of the string.
Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
|
static |
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or NULL if not found.
Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or NULL if not found.
Returns a pointer to the first occurence in "haystack" of any of the characters in "set". or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or a pointer to the NULL terminator at the end of the string if not found.
Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.
Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.
Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
|
static |
Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.
Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or NULL if not found.
Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or NULL if not found.
Returns a pointer to the last occurence in "haystack" of any of the characters in "set". or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or a pointer to the NULL terminator at the end of the string if not found.
|
static |
Returns the number of characters needed to represent "number" as a string.
|
static |
Returns the number of characters needed to represent "number" as a string.
|
static |
Returns the number of characters needed to represent "number" as a string.
|
static |
Returns the number of characters needed to represent "number" as a string.
|
static |
Returns the number of characters needed to represent "number" as a string.
|
static |
Returns the number of characters needed to represent "number" as a string.
Returns the number of characters in "string".
Note that this method expects to operate on strings encoded using a single-byte encoding, and will give unexpected results for multi-byte-encoded strings.
Returns the number of characters, starting at the beginning of "haystack" which consists entirely of characters in "set".
|
static |
Returns the number of characters, starting at the beginning of "haystack" which consists entirely of characters not in "set".
Returns the number of bytes in "string", including the null terminator.
Returns a copy of the segment of "str" between string index "start" and the end of the string, inclusive.
Returns a copy of the segment of "str" between string indices "start" and "end", inclusive.
hex-decodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to hexDecode above but only decodes the first "inputlen" characters of "input"
|
static |
similar to hexDecode() above, but returns the result in "output" and "outputsize" rather than in a return value
hex-encodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to hexEncode above but only encodes the first "inputsize" bytes of "input"
|
static |
similar to hexEncode() above, but returns the result in "output" and "outputlen" (in characters) rather than in a return value
|
static |
Creates a new string with "src" inserted into "dest" at "index".
Returns the string from the "delimiter" until the end of the string. Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.
Returns the string from the beginning of "str" until Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.
|
static |
Returns the string between "start" and "end". Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.
Returns true if "str" is found among the values in the NULL-terminated array "set". Also returns true if "str" is NULL and set is NULL or contains only a NULL-terminator. Otherwise returns false.
Returns true if "str" is found among the values in the NULL-terminated array "set", ignoring case. Also returns true if "str" is NULL and set is NULL or contains only a NULL-terminator. Otherwise returns false.
Returns true if the string "val" is an integer and false if it is not an integer.
Returns true if the string "val" is an integer and false if it is not an integer.
Returns true if "string" starts with the standalone word: "No" (case-insensitive), "False" (case-insensitive), or "0" and false otherwise.
(Eg. returns true for "No,", "False ", and "0 1 2" but returns false for "Nothing", "Falsest", and "012")
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Returns true if "string" is NULL or the empty string.
Returns true the string "val" is a number and false if it is not a number
Returns true the string "val" is a number and false if it is not a number
Returns true if "string" starts with the standalone "word": "Yes" (case-insensitive), "True" (case-insensitive), "Y" (case-insensitive), "T" (case-insensitive), or "1" and false otherwise.
(Eg. returns true for "Yes,", "True ", and "1 2 3" but returns false for "Yesterday", "Truest", and "123")
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Moves leading spaces to the end of "str" for "len" characters.
Example: " hello " -> "hello "
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Trims all spaces off of the left hand side of "str".
Trims all "character"'s off of the left hand side of "str".
Converts "str" to lowercase.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Obfuscates "str" by adding 128 to each character.
|
static |
Returns a copy of "string", padded with "padchar" to a character length of "totallen". Set "direction" to -1 to left-pad, 0 to center-pad and 1 to right-pad. Note that this method allocates a buffer internally and returns it. The calling program must deallocate this buffer.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
|
static |
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.
Allocates "buffer" to sufficient size and writes "argp" to it using "format" which should comply with standard printf formatting rules.
Returns the number of characters written to "buffer" excluding the NULL terminator.
If "buffer" is NULL then nothing is written to "buffer" and 0 is returned.
Returns -1 if an error occurred.
NOTE: wide character sequences will be converted to sequences of characters of the currently selected character set (eg. selected by the locale) which may be ASCII, extended ASCII (eg. Latin 15), or multibyte (eg. UTF8).
Allocates "buffer" to sufficient size and writes "..." to it using "format" which should comply with standard printf formatting rules.
Returns the number of characters written to "buffer" excluding the NULL terminator.
If "buffer" is NULL then nothing is written to "buffer" and 0 is returned.
Returns -1 if an error occurred.
NOTE: wide character sequences will be converted to sequences of characters of the currently selected character set (eg. selected by the locale) which may be ASCII, extended ASCII (eg. Latin 15), or multibyte (eg. UTF8).
|
static |
Appends "argp" to "buffer" of character length "len" using "format" which should comply with standard printf formatting rules.
Note that argp is a pointer to a va_list, not just a va_list.
Returns the number of characters written to "buffer" excluding the NULL terminator. If "buffer" wasn't large enough to accommodate the data then it only writes "len" characters to "buffer" but still returns the number of characters that would have been written had "buffer" been large enough.
If "buffer" is NULL or "len" is 0 then nothing is written to "buffer" but the number of characters that would have been written had "buffer" been large enough is still returned.
Returns -1 if an error occurred.
NOTE: wide character sequences will be converted to sequences of characters of the currently selected character set (eg. selected by the locale) which may be ASCII, extended ASCII (eg. Latin 15), or multibyte (eg. UTF8).
Appends "..." to "buffer" of character length "len" using "format" which should comply with standard printf formatting rules.
Returns the number of characters written to "buffer" excluding the NULL terminator. If string wasn't large enough to accommodate the data then it only writes "len" characters to "buffer" but still returns the number of characters that would have been written had "buffer" been large enough.
If "buffer" is NULL or "len" is 0 then nothing is written to "buffer" but the number of characters that would have been written had "buffer" been large enough is still returned.
Returns -1 if an error occurred.
NOTE: wide character sequences will be converted to sequences of characters of the currently selected character set (eg. selected by the locale) which may be ASCII, extended ASCII (eg. Latin 15), or multibyte (eg. UTF8).
Quoted-printable-decodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to quotedPrintableDecode above but only decodes the first "inputlen" characters of "input"
|
static |
similar to quotedPrintableDecode() above, but returns the result in "output" and "outputlen" (in characters) rather than in a return value
Quoted-printable-encodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
similar to quotedPrintableEncode above but only encodes the first "inputsize" bytes of "input"
|
static |
similar to quotedPrintableEncode() above, but returns the result in "output" and "outputlen" (in characters) rather than in a return value
Replaces all instances of "oldchar" in "str" with "newchar"
Replaces all instances of any of the characters in the set "oldchar" in "str" with "newchar"
|
static |
Returns a new string which is a copy of "str" in which all instances of strings found in the NULL-terminated array "oldstrset", have been replaced with the commensurate string found in the NULL-terminated array "newstrset", which must have the same number of members as "oldstrset"
|
static |
Returns a new string which is a copy of "str" in which all instances of strings found in the NULL-terminated array "oldstrset", the number of characters of which are given by the array "oldstrlen", have been replaced with the commensurate string found in the NULL-terminated array "newstrset", which must have the same number of members as "oldstrset"
|
static |
Returns a new string which is a copy of "str" in which all instances of "oldstr" have been replaced with "newstr"
|
static |
Returns a new string which is a copy of "str" in which parts that match "from" have been replaced with "to".
If "global" is true then all matching parts are replaced. If "global" is false then only the first matching part is replaced.
Replaces all instances of "oldchar" in "str" with "newchar", ignoring case
|
static |
Replaces all instances of any of the characters in the set "oldchar" in "str" with "newchar", ignoring case
|
static |
Returns a new string which is a copy of "str" in which all instances of strings found in the NULL-terminated array "oldstrset", have been replaced with the commensurate string found in the NULL-terminated array "newstrset", which must have the same number of members as "oldstrset", ignoring case
|
static |
Returns a new string which is a copy of "str" in which all instances of strings found in the NULL-terminated array "oldstrset", the number of characters of which are given by the array "oldstrlen", have been replaced with the commensurate string found in the NULL-terminated array "newstrset", which must have the same number of members as "oldstrset", ignoring set
|
static |
Returns a new string which is a copy of "str" in which all instances of "oldstr" have been replaced with "newstr", ignoring case
Moves trailing spaces to the beginning of "str" for "len" characters.
Example: " hello " -> " hello"
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
Trims all spaces off of the right hand side of "str".
Trims all "character"'s off of the right hand side of "str".
Replaces "dest" with "source" unless the character length of "source" is greater than "destlen", in which case only "destlen" characters of "dest" will be replaced. Returns a pointer to "dest".
|
static |
Replaces "sourcelen" characters of "dest" with "source" unless "sourcelen" is greater than "destlen", in which case only "destlen" characters of "dest" will be replaced. Returns a pointer to "dest".
|
static |
Parses NULL-terminated "string" delimited by NULL-terminated "delimiter" and allocates "listcount" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.
|
static |
Parses NULL-terminated "string" delimited by "delimiter" of character length "delimiterlen" and allocates "listcount" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.
|
static |
Parses "string" of character length "stringlen" delimited by NULL-terminated "delimiter" and allocates "listcount" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.
|
static |
Parses "string" of character length "stringlen" delimited by "delimiter" of character length "delimiterlen" and allocates "listcount" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.
Returns true if "haystack" starts with "needle" or false otherwise.
Strips all instances of "character" from "str". Returns true if any characters were stripped and false if no characters were stripped.
Strips all instances of "str2" from "str1". Returns true if any characters were stripped and false if no characters were stripped.
Strips all instances of any character in "set" from "str1". Returns true if any characters were stripped and false if no characters were stripped.
unescapes all -escaped characters found in "input" and returns the result in a buffer allocated inside the function. This buffer must be deleted by the calling program.
|
static |
similar to unescape() above, but takes an "inputlen" parameter and returns the result in "output" and "outputlen" rather than in a return value
Converts "str" to uppercase.
Note that this method expects to operate on strings encoded using ASCII or extended ASCII, and may give unexpected results for differently-encoded strings.
URL-decodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.
URL-encodes "input" and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.