std-string-elt | ![]() |
(std-string-elt <str> <i>) ; returns the i'th ascii char in string, zero-based
STD-STRING-ELT
, like STD-ELT,
returns the character at the given position in the string. The first character has the position 0.
On the contrary substr 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-ELT
.
On wrong indices a range check error is thrown. (index out of range).
0 <= i < (strlen str)
must hold!
(std-string-elt "12" 0) => 64 (std-string-elt "12" 1) => 65
str: string
i: integer number
A positive integer number.
None.
(std-require 'STDSTR)
Defined in STDSTR
#- SMALL