std-string-elt


Synopsis

(std-string-elt <str> <i>) ; returns the i'th ascii char in string, zero-based

Description

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.

Exceptional Situations

On wrong indices a range check error is thrown. (index out of range).

0 <= i < (strlen str) must hold!

Examples

(std-string-elt "12" 0) => 64
(std-string-elt "12" 1) => 65

Arguments

str: string

i: integer number

Return Value

A positive integer number.

Side Effects

None.

Module

(std-require 'STDSTR)

Defined in STDSTR

#- SMALL