2.2 String Utilities¶
-
size_t serd_strlen(const uint8_t *str, size_t *n_bytes, SerdNodeFlags *flags)¶
Measure a UTF-8 string.
- Returns:
Length of
str
in characters (except NULL).- Parameters:
str – A null-terminated UTF-8 string.
n_bytes – (Output) Set to the size of
str
in bytes (except NULL).flags – (Output) Set to the applicable flags.
-
double serd_strtod(const char *str, char **endptr)¶
Parse a string to a double.
The API of this function is identical to the standard C strtod function, except this function is locale-independent and always matches the lexical format used in the Turtle grammar (the decimal point is always “.”).
-
void *serd_base64_decode(const uint8_t *str, size_t len, size_t *size)¶
Decode a base64 string.
This function can be used to deserialise a blob node created with
serd_node_new_blob()
.- Parameters:
str – Base64 string to decode.
len – The length of
str
.size – Set to the size of the returned blob in bytes.
- Returns:
A newly allocated blob which must be freed with
serd_free()
.