|
CX Framework
Cross-platform C utility framework
|
Functions | |
| int32 | strFind (strref s, int32 start, strref find) |
| int32 | strFindi (strref s, int32 start, strref find) |
| int32 | strFindR (strref s, int32 end, strref find) |
| int32 | strFindRi (strref s, int32 end, strref find) |
| int32 | strFindChar (strref s, int32 start, char find) |
| int32 | strFindChari (strref s, int32 start, char find) |
| int32 | strFindCharR (strref s, int32 end, char find) |
| int32 | strFindCharRi (strref s, int32 end, char find) |
| int32 | strFindAny (strref s, int32 start, strref chars) |
| int32 | strFindAnyi (strref s, int32 start, strref chars) |
| int32 | strFindAnyR (strref s, int32 end, strref chars) |
| int32 | strFindAnyRi (strref s, int32 end, strref chars) |
| int32 | strFindNotAny (strref s, int32 start, strref chars) |
| int32 | strFindNotAnyi (strref s, int32 start, strref chars) |
| int32 | strFindNotAnyR (strref s, int32 end, strref chars) |
| int32 | strFindNotAnyRi (strref s, int32 end, strref chars) |
Functions for finding substrings within strings.
Case-insensitive searches are ASCII-only and do not properly handle multi-byte UTF-8 characters.
| int32 strFind | ( | strref | s, |
| int32 | start, | ||
| strref | find | ||
| ) |
Finds the first occurrence of a substring (forward search)
Searches for the first occurrence of the substring 'find' in string 's', starting at the specified position. The search proceeds forward toward the end of the string.
Negative start positions are relative to the end of the string, allowing searches from a position near the end. If the substring is not found, -1 is returned.
| s | String to search within |
| start | Starting position for search (negative = from end) |
| find | Substring to search for |
Example:
| int32 strFindAny | ( | strref | s, |
| int32 | start, | ||
| strref | chars | ||
| ) |
Finds the first byte that is a member of a set (forward search)
Searches for the first byte in 's' that appears anywhere in 'chars', starting at the specified position. This is the string-scanning equivalent of C's strpbrk().
An empty or NULL character set never matches, so -1 is returned.
| s | String to search within |
| start | Starting position for search (negative = from end) |
| chars | Set of bytes to search for |
Example:
| int32 strFindAnyi | ( | strref | s, |
| int32 | start, | ||
| strref | chars | ||
| ) |
Finds the first byte that is a member of a set, ignoring case (forward search)
Case-insensitive version of strFindAny().
| s | String to search within |
| start | Starting position for search (negative = from end) |
| chars | Set of bytes to search for |
Example:
| int32 strFindAnyR | ( | strref | s, |
| int32 | end, | ||
| strref | chars | ||
| ) |
Finds the last byte that is a member of a set (reverse search)
Searches backward from the specified end position for a byte that appears anywhere in 'chars'. The end position follows the same rules as strFindR().
An empty or NULL character set never matches, so -1 is returned.
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| chars | Set of bytes to search for |
Example:
| int32 strFindAnyRi | ( | strref | s, |
| int32 | end, | ||
| strref | chars | ||
| ) |
Finds the last byte that is a member of a set, ignoring case (reverse search)
Case-insensitive version of strFindAnyR().
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| chars | Set of bytes to search for |
Example:
| int32 strFindChar | ( | strref | s, |
| int32 | start, | ||
| char | find | ||
| ) |
Finds the first occurrence of a byte (forward search)
Searches for the first occurrence of the byte 'find' in string 's', starting at the specified position.
| s | String to search within |
| start | Starting position for search (negative = from end) |
| find | Byte to search for |
Example:
| int32 strFindChari | ( | strref | s, |
| int32 | start, | ||
| char | find | ||
| ) |
Finds the first occurrence of a byte, ignoring case (forward search)
Case-insensitive version of strFindChar().
| s | String to search within |
| start | Starting position for search (negative = from end) |
| find | Byte to search for |
Example:
| int32 strFindCharR | ( | strref | s, |
| int32 | end, | ||
| char | find | ||
| ) |
Finds the last occurrence of a byte (reverse search)
Searches backward from the specified end position for the byte 'find'. The end position can be strEnd (search the whole string), a positive byte offset, or a negative offset from the end.
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| find | Byte to search for |
Example:
| int32 strFindCharRi | ( | strref | s, |
| int32 | end, | ||
| char | find | ||
| ) |
Finds the last occurrence of a byte, ignoring case (reverse search)
Case-insensitive version of strFindCharR().
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| find | Byte to search for |
Example:
| int32 strFindi | ( | strref | s, |
| int32 | start, | ||
| strref | find | ||
| ) |
Finds the first occurrence of a substring, ignoring case (forward search)
Case-insensitive version of strFind().
| s | String to search within |
| start | Starting position for search (negative = from end) |
| find | Substring to search for |
Example:
| int32 strFindNotAny | ( | strref | s, |
| int32 | start, | ||
| strref | chars | ||
| ) |
Finds the first byte that is NOT a member of a set (forward search)
Searches for the first byte in 's' that does not appear in 'chars', starting at the specified position. This is the string-scanning equivalent of C's strspn(), and is the primitive the trim functions are built on.
An empty or NULL character set excludes nothing, so the search position itself is returned (or -1 if it is already at the end of the string).
| s | String to search within |
| start | Starting position for search (negative = from end) |
| chars | Set of bytes to skip over |
Example:
| int32 strFindNotAnyi | ( | strref | s, |
| int32 | start, | ||
| strref | chars | ||
| ) |
Finds the first byte that is NOT a member of a set, ignoring case (forward search)
Like strFindNotAny(), but a set entry excludes both cases of that letter.
| s | String to search within |
| start | Starting position for search (negative = from end) |
| chars | Set of bytes to skip over |
Example:
| int32 strFindNotAnyR | ( | strref | s, |
| int32 | end, | ||
| strref | chars | ||
| ) |
Finds the last byte that is NOT a member of a set (reverse search)
Searches backward from the specified end position for a byte that does not appear in 'chars'. The end position follows the same rules as strFindR().
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| chars | Set of bytes to skip over |
Example:
| int32 strFindNotAnyRi | ( | strref | s, |
| int32 | end, | ||
| strref | chars | ||
| ) |
Finds the last byte that is NOT a member of a set, ignoring case (reverse search)
Like strFindNotAnyR(), but a set entry excludes both cases of that letter.
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| chars | Set of bytes to skip over |
Example:
| int32 strFindR | ( | strref | s, |
| int32 | end, | ||
| strref | find | ||
| ) |
Finds the last occurrence of a substring (reverse search)
Searches for the last occurrence of the substring 'find' in string 's', searching backward from the specified end position. This is useful for finding the rightmost match or searching within a specific range.
The end position can be:
If the substring is not found, -1 is returned.
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| find | Substring to search for |
Example:
| int32 strFindRi | ( | strref | s, |
| int32 | end, | ||
| strref | find | ||
| ) |
Finds the last occurrence of a substring, ignoring case (reverse search)
Case-insensitive version of strFindR().
| s | String to search within |
| end | Ending position for search (strEnd = string end, negative = from end) |
| find | Substring to search for |
Example: