Okay... I work for a mapping company and they give me a number.
ie: -631824.69
This number represents a longitude in degrees, minutes and seconds. I need to break this number into it's respective components to store in my database.
Everything behind the period, and the two digits in front of the period are 'seconds'. This will always be two characters a dot and then another two characters. (24.69)
The first two numbers in front of the seconds are 'minutes'. No more than two characters ever. (18 )
The remaining two digits (63) are the degrees. These can be anywhere from 1 to 3 characters.
If the number is negative it is either east or west for longitude, or north and south for latitude. I've already got this one covered.
Code: Select all
-631824.69
"-" = west
"63" = degrees (can be from 1 to 3 characters)
"18" = minutes
"24.69" = seconds