include/Cnx/StringExt.h file

This module provides additional functionality for working with CnxStrings.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Functions

CnxVector(CnxString) cnx_string_split_on(const CnxString *restrict self
Splits the given string at each instance of the given delimiter character, returning a CnxVector of the resulting substrings.
CnxVector(CnxStringView) cnx_string_view_split_on(const CnxString *restrict self
Splits the given string into a set of stringviews at each instance of the given delimiter character, returning them in a CnxVector
usize cnx_string_occurrences_of_char(const CnxString*restrict self, char to_find)
Determines the total number of times the character to_find occurs in self
usize cnx_string_occurrences_of(const CnxString*restrict self, const CnxString*restrict to_find)
Determines the total number of times the string to_find occurs in self
usize cnx_string_occurrences_of_stringview(const CnxString*restrict self, const CnxStringView*restrict to_find)
Determines the total number of times the stringview to_find occurs in self
usize cnx_string_occurrences_of_cstring(const CnxString*restrict self, restrict const_cstring to_find, usize to_find_length)
Determines the total number of times the cstring to_find occurs in self
CnxVector(usize) cnx_string_find_occurrences_of_char(const CnxString *restrict self
Finds the indices at which the character to_find occurs in self, and returns them in a CnxVector

Defines

#define cnx_string_split_on(self, delimiter)
Splits the given string at each instance of the given delimiter character, returning a CnxVector of the resulting substrings.
#define cnx_string_split_on_with_allocator(self, delimiter, allocator)
Splits the given string at each instance of the given delimiter character, returning a CnxVector of the resulting substrings.
#define cnx_string_view_split_on(self, delimiter)
Splits the given string into a set of stringviews at each instance of the given delimiter character, returning them in a CnxVector
#define cnx_string_view_split_on_with_allocator(self, delimiter, allocator)
Splits the given string into a set of stringviews at each instance of the given delimiter character, returning them in a CnxVector
#define cnx_string_occurrences_of_char(self, to_find)
Determines the total number of times the character to_find occurs in self
#define cnx_string_occurrences_of(self, to_find)
Determines the total number of times the string or string-like to_find occurs in self
#define cnx_string_find_occurrences_of_char(self, to_find)
Finds the indices at which the character to_find occurs in self, and returns them in a CnxVector
#define cnx_string_find_occurrences_of_char_with_allocator(self, to_find, allocator)
Finds the indices at which the character to_find occurs in self, and returns them in a CnxVector
#define cnx_string_find_occurrences_of(self, to_find)
Finds the indices at which the string or string-like to_find occurs in self, and returns them in a CnxVector
#define cnx_string_find_occurrences_of_with_allocator(self, to_find, allocator)
Finds the indices at which the string or string-like to_find occurs in self, and returns them in a CnxVector