Need Help Reformatting DMS String
Hello,
I am trying to reformat my raw string to make it look like the following converted string.
Raw:
45 29 55.6929602297123 N 66 8 25.0543388360666 W
Converted:
45295569N066082505W
Formatting issues:
As you can see in the W, the 66 must be formatted 066(3-digit) and all the others must 2-digit, i.e. with 8 must be 08. Also, the only the first 2-decimal points are used.
Thank you for your help.
Re: Need Help Reformatting DMS String
You need to first parse the original String, which would most likely be done by calling String.Split and then converting the numeric elements to the appropriate numeric types using CInt and CDec or, preferably, Convert.ToInteger and Convert.ToDecimal. You can then multiply the two Decimal values by 100 and then it's a simple call to String.Format to create the output.
Re: Need Help Reformatting DMS String
Thanks, that was enough to get me thinking in the right direction. I have the converter built thanks to your help.