|
-
Dec 29th, 2014, 03:28 PM
#1
Thread Starter
New Member
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.
-
Dec 29th, 2014, 09:45 PM
#2
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.
-
Dec 30th, 2014, 07:51 AM
#3
Thread Starter
New Member
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|