Other Functions
Home Function Descriptions Downloads Other Functions GeoCalcİ Experimental Stuff

 

                       

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).

the format returned is controlled by the value of llenum and places as follows:

 llenum = DMSString
     places  =  0 ##\° ##\' ##\"" >?
                 =  1 ##\° ##\' ##.#\"" >?
                 = 2 ##\° ##\' ##.##\"" >?
                 = 3 ##\° ##\' ##.###\" >?
     etc

 llenum = DMString
     places = 0 ##\° ##\' >?
                = 1 ##\° ##.#\' >?
                = 2 ##\° ##.##\' >?
                = 3 ##\° ##.###\' >?
 etc
you get the idea.

latorlong signals if latitude or longitude is desired. Use WICLATITUDE or WICLONGITUDE as this flag

places is limited to a max of 5


the function returns WICNOERROR if successful else
it returns:
 UTLBADENUM if llenum is invalid
 UTLBADARG if latorlong is invalid

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

The function returns:
 WICNOERROR if OK
 WICBADMINSEC if either minutes exceeds WICMAXMINS or seconds exceed WICMAXSECS
 UTLBADHEMI if the hemisphere flag is invalid
 UTLBADARG if llenum is improper

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.

 

 

 

Top

This page was last updated on 12/03/2003