Symisc Systems

Libcox Command Reference


Star Follow @symisc

Command Syntax

substr_count haystack needle [offset = 0] [length]


Alias

None


Description

Count the number of substring occurrences.


Parameters

haystack

The string to search in.

needle

The substring to search for.

offset

Optional Parameter: The offset where to start counting.

length

Optional Parameter: Not used The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is greater than the haystack length.


Return Value

Integer: Total number of substring occurrences. Use libcox_value_to_int() to extract the processing result.