Strings

EsCStringLength

size_t EsCStringLength(EsCString string);

Returns the number of bytes in the string, not including the null terminator. Returns 0 if the string is NULL.

EsStringAllocateAndFormat

char *EsStringAllocateAndFormat(size_t *bytes, EsCString format, ...);

Zero-terminated.

EsStringAllocateAndFormatV

char *EsStringAllocateAndFormatV(size_t *bytes, EsCString format, va_list arguments);

Formats a string and allocates a zero-terminated buffer for it. Returns NULL if there is not enough memory. Free with EsHeapFree.

EsStringCompare

int EsStringCompare(STRING s1, STRING s2);

Compares two strings, ignoring case and comparing runs of digits as numbers. Returns a negative, zero, or positive value.

EsStringCompareRaw

int EsStringCompareRaw(STRING s1, STRING s2);

Compares two strings byte by byte. Returns a negative, zero, or positive value.

EsStringFormat

ptrdiff_t EsStringFormat(char *buffer, size_t bufferLength, EsCString format, ...);

Not zero-terminated.

EsStringFormatTemporary

const char *EsStringFormatTemporary(EsCString format, ...);

Not thread safe. The result is valid until the next call. Zero-terminated.

EsStringFormatV

ptrdiff_t EsStringFormatV(char *buffer, size_t bufferLength, EsCString format, va_list arguments);

Formats a string into the buffer. Returns the number of bytes written, stopping when the buffer is full.

EsStringFormatAppend

bool EsStringFormatAppend(char *buffer, size_t bufferLength, size_t *bufferPosition, EsCString format, ...);

Return false if buffer filled.

EsStringFormatAppendV

bool EsStringFormatAppendV(char *buffer, size_t bufferLength, size_t *bufferPosition, EsCString format, va_list arguments);

Appends formatted text to the buffer at the given position. Updates the position. Returns false if the buffer filled.

EsUTF8IsValid

bool EsUTF8IsValid(STRING input);

Does not check for surrogate characters or overlong sequences of non-ASCII characters.

EsDoubleParse

double EsDoubleParse(STRING string, char **endptr);

Parses a floating point number from the string. If endptr is set, it receives the position after the number.

EsIntegerParse

int64_t EsIntegerParse(STRING text);

Parses in hexadecimal if the first two characters are '0x'.

EsUniqueIdentifierParse

EsUniqueIdentifier EsUniqueIdentifierParse(STRING text);

Parses an identifier in the form XX-XX-...-XX. Returns all zeros if the text is not a valid identifier.