Difference between revisions of "MI Using String Functions"
Jump to navigation
Jump to search
Ari Craven (talk | contribs) |
Chris Huxley (talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
! Function | ! Function | ||
− | ! width= | + | ! width=75% | 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). | ||
+ | |- | ||
+ | |'''LCase$'''( str ) || Returns a lowercase version of the string str. | ||
+ | |- | ||
+ | |'''Left$'''( str , num ) || Returns the first num characters of the string str. | ||
+ | |- | ||
+ | |'''Len'''( str ) || Returns the number of characters in a string. | ||
+ | |- | ||
+ | |'''LTrim$'''( str ) || Trims any spaces from the start of str and returns result. | ||
+ | |- | ||
+ | |'''Mid$'''( str, num1, num2 ) || Returns a portion of the string str starting at character position num1 and extending for num2 characters. | ||
+ | |- | ||
+ | |'''Proper$'''( str ) || Returns a string with proper capitalization (first letter of each word capitalized). | ||
+ | |- | ||
+ | |'''Right$'''( str , num ) || Returns the last num characters of the string str. | ||
+ | |- | ||
+ | |'''RTrim$'''( str ) || Trims any spaces from the end of str and returns result. | ||
+ | |- | ||
+ | |'''Str$'''( expr ) || Returns a string approximation of an expression. | ||
+ | |- | ||
+ | |'''UCase$'''( str ) || Returns an uppercase (all capitalized) version of str. | ||
+ | |- | ||
+ | |'''Val'''( str ) || Returns the numeric value of the string; for example, Val("18") returns the number 18. | ||
|- | |- | ||
− | |||
|} | |} | ||
+ | |||
+ | |||
+ | |||
+ | {{Tips Navigation | ||
+ | |uplink=[[MapInfo_Tips | Back to MapInfo Tips]]}} |
Latest revision as of 09:52, 6 February 2015
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). |
LCase$( str ) | Returns a lowercase version of the string str. |
Left$( str , num ) | Returns the first num characters of the string str. |
Len( str ) | Returns the number of characters in a string. |
LTrim$( str ) | Trims any spaces from the start of str and returns result. |
Mid$( str, num1, num2 ) | Returns a portion of the string str starting at character position num1 and extending for num2 characters. |
Proper$( str ) | Returns a string with proper capitalization (first letter of each word capitalized). |
Right$( str , num ) | Returns the last num characters of the string str. |
RTrim$( str ) | Trims any spaces from the end of str and returns result. |
Str$( expr ) | Returns a string approximation of an expression. |
UCase$( str ) | Returns an uppercase (all capitalized) version of str. |
Val( str ) | Returns the numeric value of the string; for example, Val("18") returns the number 18. |
Up |
---|
Back to MapInfo Tips |