- Introduction
- License
- History
- Compilation & Hosting
- Configuration File
- Modules:
- FAQ
- Links
- Credits
|
Declaration:
-
function substr_count(const str, sub: string): longint;
Arguments:
-
str |
Source string for search |
sub |
Substring to search for |
Description:
-
Counts number of occurrences of needle sub in haystack str.
Returns:
-
Number of substring occurrences on success or 0 if substring was not found.
Usage:
-
s := 'Don`t trouble trouble until trouble troubles you.';
i := substr_count(s, 'trouble');
writeln('Number of troubles: ', i);
See also:
-
substr_pos, substr_rpos, substr_exists, substr_icount.
|