A set of EASI intrinsic functions perform useful operations on strings. The length of a string is given by the f$len() intrinsic function:
EASI>print f$len("file")
4
The case of a string can be changed using the f$upcase() and f$lowcase() intrinsic functions, as follows:
EASI>print f$upcase("abc")
ABC
EASI>print f$lowcase("ABC")
abc
A numeric value stored within a string can be extracted using the f$value() intrinsic:
local float x
x = f$value("-3.25")
Conversely, the f$string function can be used to convert a numeric value to a string:
local string s s = f$string(-3.25)
The FindSubString() intrinsic function can be used to find the location within a string of a given substring. It returns the index of the start of the substring if successful, or -1 if unsuccessful. The search is case-insensitive.
EASI>print FindSubString( "Pixels: 256 Lines:512", "lines" ) 13
FindSubString() takes an optional third argument, which is the location within the string at which to start searching. This can be used to continue searching for a subsequent occurrence of the string:
EASI>print Coordinates X:24 Y:32 Z:18 X:23 Y:32 Z:19 EASI>print FindSubString(Coordinates, "y") 6 EASI>print FindSubString(Coordinates, "y", 7) 21
FindSubString() can also be used to return the line within an mstring that contains a given substring. For example suppose an mstring called "Header" contains the following data:
EASI>print Header Channels: 10 Pixels: 256 Lines: 512 8-Bit Unsigned EASI>print FindSubString(Header, "Lines") 2
The FindSubString() intrinsic could then be used again on the resulting line to determine the location within that line of the desired string.
The f$extract() intrinsic function will extract a substring from a given string given the location and length of the substring to extract. For example, to extract a string starting from the 11 character of the string called "data" that is 10 characters long:
EASI>print data filename: irvine.pix EASI>print f$extract(data, 11, 10) irvine.pix
The Tokenize() intrinsic function is used to break-up a white-space delimited string into an mstring. White-space is any number of spaces, tabs, and newline characters. For example, given a string called data that contains four numeric values:
EASI>print data 3.5 7 -9 5.5 EASI>local mstring t EASI>t = Tokenize( data ) EASI>print t 3.5 7 -9 5.5
The resulting mstring called "t" will have four lines, each containing a substring from the input line with the white-space removed. The Tokenize() function also takes an optional second argument specifying alternate delimiters. For example, to separate a string by commas and spaces, the following form of the Tokenize() command could be used.
EASI>print data 3.5,7 -9,5.5 EASI>t = Tokenize(data, ", ") EASI>print t 3.5 7 -9 5.5
The f$char() and f$ascii() intrinsic functions can be used to convert between characters and their ASCII representations. Further information on these and all the other string intrinsics are available in the EASI reference manual and on-line help.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.