POS

Member Of Menu: 
String
List
Argument Types: 
Any
List
String
Symbol
Expression
Result Type(s): 
Real
Expression
Invertible: 
No
Valid In Expression: 
Yes
Stack Diagram: 
String1 String2 Real3
List1 Item2 Real3
Symbol1 Symbol2 Expression3
Expression1 Expression2 Expression3

This operation is used to find the position of a substring within a string or the position of an item in a list. If provided two strings, it searches for the index into string1 where string2 can be found. The index is 1 based and POS returns 0 if the string2 can not be found within string1.

If a list is provided, then the item on the stack is compared to each item on the list until a match is found. If no match is found, POS returns 0. Otherwise, it returns the index within the list where the first match was found.