The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Declaration:function ScanDegrees (InString: string; var Idx: integer; ExpectGeo: boolean; var Error: integer): double;

The function ScanDegrees parses the string InString for degrees, arc-minutes and arc-seconds and returns the result as the function value. The variable parameter Idx specifies the position where to start the parsing of InString. If ExpectGeo is TRUE the function requires the compass direction to be specified at the end of the string (N, S, E, W).

Following are a few examples of valid input strings (assuming ExpectGeo to be TRUE):

    20.37711 N
    221 24.3333'W
    71 24' 20" W
    22.6255 S

Please note that the degree symbol may be omitted if the input string is terminated by a valid compass direction and the parameter ExpectGeo is TRUE (see last example above).

The variable parameter error returns the following error codes:

0 no error
-1 digit expected
-2 degree symbol () missing
-3 decimal degrees must not be followed by minutes or seconds
-4 minute symbol (') missing
-5 decimal minutes must not be followed by seconds
-6 second symbol (") missing
-7 missing compass direction
-8 invalid value of minutes (>= 60)
-9 invalid value of seconds (>= 60)

Last Update: 2012-Oct-20