Dear monks,
this is probably a rather trivial question, but it is driving me nuts, and I can not manage to get it to work.
I have a latitude in degrees minutes seconds, like this:
55°48'10.000
I need to convert this to decimal degrees and to do that I need the 3 values separated by respectively ° and ' put into 3 separate variables.
Could anyone enlighten me on how to accomplish that? I first thought I could just substitute the ° sign with ' and then split on ' - but I am not able to do anything with °.
rgds,
Ole C.
Update
Thanks a lot for the suggestions. I ended up using davorgs solution since that was exactly what I wanted to do, but I also learned a new one with the \xB0 in the split from thundergnat.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.