Difference between revisions of "MI Using String Functions"

From Tuflow
Jump to navigation Jump to search
Line 7: Line 7:
 
! width=50% | Description
 
! width=50% | Description
 
|-
 
|-
|'''Chr$'''( num ) || Returns a character that corresponds to a character code (e.g. Chr$(65) returns the string "A").
+
|align="center"|'''Chr$'''( num ) || Returns a character that corresponds to a character code (e.g. Chr$(65) returns the string "A").
 
|-
 
|-
 
|'''DeformatNumber$'''( str ) || Reverses the effect of the FormatNumber$ function, returning a string that does not include thousands separators.  
 
|'''DeformatNumber$'''( str ) || Reverses the effect of the FormatNumber$ function, returning a string that does not include thousands separators.  

Revision as of 20:56, 5 September 2011

MapInfo has a range of string (text) functions that offer the user excellent query and text manipulation opportunities. The string functions from the MapInfo help are documented below, and an example of using a few of these string functions for selecting and manipulating a GIS dataset is presented.

Function Description
Chr$( num ) Returns a character that corresponds to a character code (e.g. Chr$(65) returns the string "A").
DeformatNumber$( str ) Reverses the effect of the FormatNumber$ function, returning a string that does not include thousands separators.
Format$( num , str ) Returns a string representing a formatted number. Example: Format$( 12345.678, "$,#.##") returns "$12,345.68".
FormatNumber$( num ) Returns a string representing a formatted number. This function is simpler to use than Format$, but it gives you less control over formatting (e.g. you always get thousands separators).
InStr( num , str1 , str2 ) Searches the string str1 starting at character position num, and looks for an occurrence of the string str2. Returns the position where str2 was found, or zero if not found. To start search at beginning, use a num value of one (1).