std-string-position | ![]() |
(std-string-position <ascii> <str>) ;searches integer char in string, zero-based
STD-STRING-POSITION
returns the position of the first found single character in the string., or nil if none is found. The first character has the position 0.
On the contrary std-strpos is one based and supports substrings too.
Low-level string functions dealing with integer characters are STD-STRING-ELT
, STD-STRING-POSITION
, STD-STRING->LIST
and STD-LIST->STRING
. The advantage using single integers instead of single character strings is less memory housekeeking, but the disadvantage is less readability. The often occur in library but not in user functions.
It is the same as the VLISP extension VL-STRING-POSITION
.
(std-string-position 65 "12") => nil (std-string-position (ascii "1") "12") => 0
ascii: positive integer number
str: string
A positive integer number (0 or higher) or nil..
None.
(std-require 'STDSTR)
Defined in STDSTR