std-strpos, std-stripos


Synopsis

(std-strpos <substr> <str>) ;case sensitive, one-based

(std-stripos <substr> <str>) ;case insensitive, one-based

Description

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).

Examples

(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

Arguments

substr, str: strings

Return Value

A positive integer number (1 or higher) or nil..

Side Effects

None.

Module

(std-require 'STDSTR)

Defined in STDSTR