|
![]() |
||||||||||||||
Primitive Data Types TutorialSearch FunctionsWafl contains the following string searching functions: strPos : (String * String -> Integer) strPosI : (String * String -> Integer) strLastPos : (String * String -> Integer) strLastPosI : (String * String -> Integer) strNextLastPos : (String * String * Integer -> Integer) strNextLastPosI : (String * String * Integer -> Integer) strNextPos : (String * String * Integer -> Integer) strNextPosI : (String * String * Integer -> Integer) All functions return the beginning position of the second specified string in the first specified string, if it is found, and -1 if it is not. Functions, which names end with 'I', ignore the letter case. Function strPos(s,p) returns the position of the first appearance of the string p in string s. Function strNextPos(s,p,i) returns the position of the first appearance of the string p in string s after the position i. Function strLastPos(s,p) returns the position of the last appearance of the string p in string s. Function strNextLastPos(s,p,i) returns the position of the last appearance of the string p in string s before the position i. Source code:{# strPos( 'abcabcabc', 'b' ), strLastPos( 'abcabcabc', 'b' ), strNextPos( 'abcabcabc', 'b', 1 ), strNextLastPos( 'abcabcabc', 'b', 7 ) #} Result:{# 1, 7, 4, 4 #}
|
|
||||||||||||||
© 2006 Saša Malkov | |||||||||||||||