Substring

Finds a string in a larger string.

Syntax

substring(String, List, Integer)

Description

Given a string s, a list of strings {s1,...,sk}, and a positive integer n, searches si in sLaTeXs starting from the nLaTeXn-th char. If more than one sj appear in the original string, only the first appearance is returned. If the find ends with no matches, failed is returned. The output is a list with two elements: an integer with the position of the string and the string siLaTeXs_i.

programming.substring1.calc.png

Given a string sLaTeXs and a list of strings {s1,...,sk}LaTeX\lbrace s_1, ..., s_k \rbrace, searches siLaTeXs_i in sLaTeXs. If more than one sjLaTeXs_j appear in the original string, only the first appearance is returned. If the find ends with no matches, failed is returned. The output is a list with two elements: an integer with the position of the string and the string siLaTeXs_i.

programming.substring2.calc.png