searchtext - Maple Help

searchtext

case insensitive string searching

SearchText

case sensitive string searching

 Calling Sequence SearchText(pattern, string, range) searchtext(pattern, string, range)

Parameters

 pattern - string or name to be searched for string - string or name to be searched range - (optional) range of integers. Search for the pattern only in the substring determined by the range

Description

 • SearchText and searchtext are very similar. SearchText searches for the pattern in the string looking for exact matches.  The searchtext function does the same searching, but it is case insensitive; that is, upper/lower case differences are ignored.
 • If the pattern is found, both functions return an integer which indicates the position of the first character that matched. If the pattern is not found in the string, these functions return 0.
 • The optional range restricts the search to the given positions. It is equivalent to searching on substring(string, range). This is useful when the pattern occurs more than once in the string. Negative integers in the range stand for positions counted leftwards from the right end of the string. The first position is 1.  The range $1..-1$ searches the entire string; the range $-20..-1$ searches the pattern in the last 20 characters of the string.

 • The searchtext and SearchText commands are thread-safe as of Maple 15.

Examples

 > $\mathrm{SearchText}\left("wx","abcdefghijklmnopqrstuvwxyz"\right)$
 ${23}$ (1)
 > $\mathrm{SearchText}\left(\mathrm{Vwx},\mathrm{abcdefghijklmnopqrstuvwxyz}\right)$
 ${0}$ (2)
 > $\mathrm{SearchText}\left("ijklm","abcdefghijklmnopqrstuvWxy",5..-5\right)$
 ${5}$ (3)
 > $\mathrm{SearchText}\left(\mathrm{ijklm},\mathrm{abcdefghijklmnopqrstuvwxy},10..-1\right)$
 ${0}$ (4)
 > $\mathrm{searchtext}\left(\mathrm{Vwx},\mathrm{abcdefghijklmnopqrstuvwxyz}\right)$
 ${22}$ (5)
 > $\mathrm{searchtext}\left("AbCdEfGhIjKlMnOpQrStUvWxyz","aBcDeFgHiJkLmNoPqRstuvWxyz"\right)$
 ${1}$ (6)