- Introduction
- License
- History
- Compilation & Hosting
- Configuration File
- Modules:
- FAQ
- Links
- Credits
|
Declaration:
-
function substr_pos(const str, sub: string): longint;
Arguments:
-
str |
Source string for search |
sub |
Substring to search for |
Description:
-
Returns position of first occurrence of needle sub in haystack str.
Returns:
-
1-based substring position on success or 0 if substring was not found.
Usage:
-
s := 'Does this haystack contain any needles?';
i := substr_pos(s, 'needle');
writeln('Needle position: ', i);
See also:
-
substr_ipos, substr_rpos, substr_exists, substr_count.
|