tetl 0.1.0
Embedded Template Library
|
Various narrow character string handling functions. More...
Functions | |
auto | memcmp (void const *lhs, void const *rhs, etl::size_t count) noexcept -> int |
Reinterprets the objects pointed to by lhs and rhs as arrays of unsigned char and compares the first count bytes of these arrays. The comparison is done lexicographically. | |
auto | memcpy (void *dest, void const *src, etl::size_t n) -> void * |
Copy the first n bytes pointed to by src to the buffer pointed to by dest. Source and destination may not overlap. If source and destination might overlap, memmove() must be used instead. | |
auto | memmove (void *dest, void const *src, etl::size_t count) -> void * |
Copy the first n bytes pointed to by src to the buffer pointed to by dest. Source and destination may overlap. | |
auto | memset (void *s, int c, etl::size_t n) -> void * |
Copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s. | |
constexpr auto | strcat (char *dest, char const *src) noexcept -> char * |
Appends a copy of the character string pointed to by src to the end of the character string pointed to by dest. The character src[0] replaces the null terminator at the end of dest. The resulting byte string is null-terminated. | |
constexpr auto | strcmp (char const *lhs, char const *rhs) -> int |
Compares the C string lhs to the C string rhs. | |
constexpr auto | strcpy (char *dest, char const *src) -> char * |
Copies the character string pointed to by src, including the null terminator, to the character array whose first element is pointed to by dest. | |
constexpr auto | strcspn (char const *dest, char const *src) noexcept -> etl::size_t |
Returns the length of the maximum initial segment of the byte string pointed to by dest, that consists of only the characters not found in byte string pointed to by src. | |
constexpr auto | strlen (char const *str) -> etl::size_t |
Returns the length of the C string str. | |
constexpr auto | strncat (char *dest, char const *src, etl::size_t const count) -> char * |
Appends a byte string pointed to by src to a byte string pointed to by dest. At most count characters are copied. The resulting byte string is null-terminated. | |
constexpr auto | strncmp (char const *lhs, char const *rhs, etl::size_t count) -> int |
Compares at most count characters of two possibly null-terminated arrays. The comparison is done lexicographically. Characters following the null character are not compared. | |
constexpr auto | strncpy (char *dest, char const *src, etl::size_t const count) -> char * |
Copies at most count characters of the byte string pointed to by src (including the terminating null character) to character array pointed to by dest. | |
constexpr auto | strspn (char const *dest, char const *src) noexcept -> etl::size_t |
Returns the length of the maximum initial segment (span) of the byte string pointed to by dest, that consists of only the characters found in byte string pointed to by src. | |
auto | memchr (void *ptr, int ch, etl::size_t n) -> void * |
Converts ch to unsigned char and locates the first occurrence of that value in the initial count characters (each interpreted as unsigned char) of the object pointed to by ptr. | |
auto | memchr (void const *ptr, int ch, etl::size_t n) -> void const * |
Converts ch to unsigned char and locates the first occurrence of that value in the initial count characters (each interpreted as unsigned char) of the object pointed to by ptr. | |
constexpr auto | strchr (char const *str, int ch) -> char const * |
Finds the first occurrence of the character static_cast<char>(ch) in the byte string pointed to by str. | |
constexpr auto | strchr (char *str, int ch) -> char * |
Finds the first occurrence of the character static_cast<char>(ch) in the byte string pointed to by str. | |
constexpr auto | strpbrk (char const *dest, char const *breakset) noexcept -> char const * |
Scans the null-terminated byte string pointed to by dest for any character from the null-terminated byte string pointed to by breakset, and returns a pointer to that character. | |
constexpr auto | strpbrk (char *dest, char *breakset) noexcept -> char * |
Scans the null-terminated byte string pointed to by dest for any character from the null-terminated byte string pointed to by breakset, and returns a pointer to that character. | |
constexpr auto | strrchr (char const *str, int ch) noexcept -> char const * |
Finds the last occurrence of the character static_cast<char>(ch) in the byte string pointed to by str. | |
constexpr auto | strrchr (char *str, int ch) noexcept -> char * |
Finds the last occurrence of the character static_cast<char>(ch) in the byte string pointed to by str. | |
constexpr auto | strstr (char *haystack, char *needle) noexcept -> char * |
Finds the first occurrence of the byte string needle in the byte string pointed to by haystack. The terminating null characters are not compared. | |
constexpr auto | strstr (char const *haystack, char const *needle) noexcept -> char const * |
Finds the first occurrence of the byte string needle in the byte string pointed to by haystack. The terminating null characters are not compared. | |
Various narrow character string handling functions.
|
inlinenodiscard |
Converts ch to unsigned char and locates the first occurrence of that value in the initial count characters (each interpreted as unsigned char) of the object pointed to by ptr.
This function behaves as if it reads the characters sequentially and stops as soon as a matching character is found: if the array pointed to by ptr is smaller than count, but the match is found within the array, the behavior is well-defined.
https://en.cppreference.com/w/cpp/string/byte/memchr
|
inlinenodiscard |
Converts ch to unsigned char and locates the first occurrence of that value in the initial count characters (each interpreted as unsigned char) of the object pointed to by ptr.
This function behaves as if it reads the characters sequentially and stops as soon as a matching character is found: if the array pointed to by ptr is smaller than count, but the match is found within the array, the behavior is well-defined.
https://en.cppreference.com/w/cpp/string/byte/memchr
|
inlinenodiscardnoexcept |
Reinterprets the objects pointed to by lhs and rhs as arrays of unsigned char and compares the first count bytes of these arrays. The comparison is done lexicographically.
|
inline |
Copy the first n bytes pointed to by src to the buffer pointed to by dest. Source and destination may not overlap. If source and destination might overlap, memmove() must be used instead.
|
inline |
Copy the first n bytes pointed to by src to the buffer pointed to by dest. Source and destination may overlap.
|
inline |
Copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s.
|
constexprnoexcept |
Appends a copy of the character string pointed to by src to the end of the character string pointed to by dest. The character src[0] replaces the null terminator at the end of dest. The resulting byte string is null-terminated.
The behavior is undefined if the destination array is not large enough for the contents of both src and dest and the terminating null character. The behavior is undefined if the strings overlap.
|
nodiscardconstexpr |
Finds the first occurrence of the character static_cast<char>(ch) in the byte string pointed to by str.
The terminating null character is considered to be a part of the string and can be found if searching for '\0'.
|
nodiscardconstexpr |
Finds the first occurrence of the character static_cast<char>(ch) in the byte string pointed to by str.
The terminating null character is considered to be a part of the string and can be found if searching for '\0'.
|
nodiscardconstexpr |
Compares the C string lhs to the C string rhs.
This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached.
|
constexpr |
Copies the character string pointed to by src, including the null terminator, to the character array whose first element is pointed to by dest.
The behavior is undefined if the dest array is not large enough. The behavior is undefined if the strings overlap.
|
nodiscardconstexprnoexcept |
Returns the length of the maximum initial segment of the byte string pointed to by dest, that consists of only the characters not found in byte string pointed to by src.
The function name stands for "complementary span"
|
nodiscardconstexpr |
Returns the length of the C string str.
|
constexpr |
Appends a byte string pointed to by src to a byte string pointed to by dest. At most count characters are copied. The resulting byte string is null-terminated.
The destination byte string must have enough space for the contents of both dest and src plus the terminating null character, except that the size of src is limited to count. The behavior is undefined if the strings overlap.
|
nodiscardconstexpr |
Compares at most count characters of two possibly null-terminated arrays. The comparison is done lexicographically. Characters following the null character are not compared.
The behavior is undefined when access occurs past the end of either array lhs or rhs. The behavior is undefined when either lhs or rhs is the null pointer.
|
constexpr |
Copies at most count characters of the byte string pointed to by src (including the terminating null character) to character array pointed to by dest.
If count is reached before the entire string src was copied, the resulting character array is not null-terminated. If, after copying the terminating null character from src, count is not reached, additional null characters are written to dest until the total of count characters have been written. If the strings overlap, the behavior is undefined.
|
nodiscardconstexprnoexcept |
Scans the null-terminated byte string pointed to by dest for any character from the null-terminated byte string pointed to by breakset, and returns a pointer to that character.
|
nodiscardconstexprnoexcept |
Scans the null-terminated byte string pointed to by dest for any character from the null-terminated byte string pointed to by breakset, and returns a pointer to that character.
|
nodiscardconstexprnoexcept |
Finds the last occurrence of the character static_cast<char>(ch) in the byte string pointed to by str.
The terminating null character is considered to be a part of the string and can be found if searching for '\0'.
|
nodiscardconstexprnoexcept |
Finds the last occurrence of the character static_cast<char>(ch) in the byte string pointed to by str.
The terminating null character is considered to be a part of the string and can be found if searching for '\0'.
|
nodiscardconstexprnoexcept |
Returns the length of the maximum initial segment (span) of the byte string pointed to by dest, that consists of only the characters found in byte string pointed to by src.
|
nodiscardconstexprnoexcept |
Finds the first occurrence of the byte string needle in the byte string pointed to by haystack. The terminating null characters are not compared.
|
nodiscardconstexprnoexcept |
Finds the first occurrence of the byte string needle in the byte string pointed to by haystack. The terminating null characters are not compared.