ELOC(1,2,3,4,5)
PURPOSE
This is an instring function. It will return the location of a string of characters (A type field) within another A type field, starting at the end of the field and working towards the beginning.
PARTS
1 f/c/e | Required - Field to check for, must be A type. |
2 f/c/e | Required - Field to check within, must be A type. |
3 f/c/e | The character position to start checking at. The first position (far left) is 1. If this isn't provided the default value is the end of the field. |
4 f/c/e | The number of characters to check. If this isn't provided the function will check the entire field (part 2). |
5 f/c/e | If this is set to Y, the function will ignore differences in case (upper or lower). Default is N. |
RETURN TYPE - I
The first character position of the matched field. If no match is found the value returned is 0.
SEE ALSO
LOC()
EXAMPLE
define x type i
define s type a size 20
s = 'ABCDEFGHCDIJ'
x = ELOC('CD',x)
// x = 9
x = ELOC('CD',x,3)
// x = 3
define srch_fld type a size 10
srch_fld='CD'
// make sure you trim srch_fld since the # of chars
// you're looking for is less than the size of the field.
x = ELOC(trim(srch_fld,'t'),s)
// x = 9
Page url: http://www.cassoftware.com/tas/manual/stringlocstartatend().htm