|
|
|
Delphi: The Delphi source distribution contains the file WICStrings.PAS. This file contains several functions to handle strings. This file is included in the "Uses" clause of Mapstuff.PAS. The file includes: StringRight: Function StrRight(const S: string; Count: Integer): string; This function apes the Right$ function in Visual Basic and returns the rightmost Count characters from the string S. StrLeft: Function StrLeft(const S: string; Count: Integer): string; This function apes the Left$ function in Visual Basic and returns the first Count characters from the string S. StrMid: Function StrMid(const S: string; Start, Count: Integer): string; This function apes the Mid$ function in Visual Basic and returns a sub-string of length Count extracted from string S beginning at position Start. InStr: Function InStr(Start: integer; S: string; SFind: string): integer; This function apes the Instr function in Visual Basic and returns the
position in string S where the sub-string SFind begins. If the sub-string does
not exist in string S then the function returns zero. The Delphi distributions contain the file
StrTokenizer.PAS. This general purpose function parses a string TokenString and returns the tokens
found in the string. The user defines the token separator
character(s) and can specify that null tokens be included or excluded. The
function returns a token count of zero if NO tokens are found else it returns
the actual token count. i.e. 'aaa,,bbb,ccc' would yield a token count of 4 if IncludeEmpty is True or 3 if it were
False. StrTokenizer returns the tokens in a TStringList. The Mapstuff.PAS function
ParseLatLong uses StrTokenizer to handle some formatting details and the user
should look at that function to see how the tokenizer is used Visual Basic: The Visual Basic distribution contains the file WICUtilities.BAS. This file contains several routines to make life easier for the programmer. CenterForm: This is a simple function to center a form on the screen. BuildMEString: this function builds a format string for use in the masked edit control for inputting either a latitude or longitude value.
the function assumes that the appropriate hemisphere will be appended to the input value, i.e. 12° 34' 56.789" N.
the string returned enforces the concept that latitude degrees are DD (two digit) and longitude degrees are DDD (three digit).
ParseMELatLong: this function parses the string s returned from a maskedit control using mask created by BuildMEString and extracts the degrees, minutes and
seconds. The string s must be in the format DD° MM' SS.ss" N or other variation supported by BuildMEString. The string
delimiters are the degree 'sign(°), the minute sign(') and the second sign("). The last token
is assumed to be one of the Hemisphere designators (N,S,E,W) The angle is returned as decimal degrees in d with sign consistant with
'the hemisphere. Valid value of d is NOT checked i.e. Lat>90 Tokenizer: This general purpose function parses a string TString and also returns the token found in the string. In this tokenizer the tokens are returned in a zero based array and the function return value is the token count or -1 if no tokens are found. If the optional function paramenter IncludeEmpty is true then null tokens will be included in the array and the token count will reflect this. Mapstuff.BAS uses Tokenizer in the function ParseLatLong to handle some of the formatting details and the user should look at that function to see how the tokenizer is used.
This page was last updated on 12/03/2003 |