std-strpos, std-stripos | ![]() |
(std-strpos <substr> <str>) ;case sensitive, one-based
(std-stripos <substr> <str>) ;case insensitive, one-based
STD-STRPOS
returns the position of the first found substring in the string., or nil if none is found. The first character has the position 1.
On the contrary STD-STRING-POSITION
is zero based and takes an integer argument.
STD-STRIPOS
converts both arguments to uppercase before the search, so it is case independent.
Note
STD-STRIPOS
is dependent on the current stdlib codepage, which defaults to "iso8859-1". This will only affect characters above (CHR 127)
.
(std-strpos "0123" "12") => 2 (std-stripos "Test" "st") => 3 (std-strpos "Test" "t") => nil (std-stripos "Test" "t") => 1
maybe also: (std-position "T" "Test") => 0
substr, str: strings
A positive integer number (1 or higher) or nil..
None.
(std-require 'STDSTR)
Defined in STDSTR