comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » handling numbers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
handling numbers [message #33179] Fri, 13 December 2002 08:43 Go to next message
Steve.Morris is currently offline  Steve.Morris
Messages: 17
Registered: November 2002
Junior Member
Hi!
I am stuck on a problem, probably it is very easy, but I don't know the solutions!

I have a list of number in this form:

000237.9
000246.3
000257.0
........

and I would like to write them in this form:
00 02 37.9
00 02 46.3
00 02 57.0

Is there any command that can do this?
Thank you very much!
Steve
Re: handling numbers [message #33244 is a reply to message #33179] Sun, 15 December 2002 13:13 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
<wmc@bas.ac.uk> wrote in message news:3dfa6197@news.nwl.ac.uk...
> Richard Adams <rja46@cam.ac.uk> wrote:
>>> 000237.9
>>>
>>> and I would like to write them in this form:
>>> 00 02 37.9
>
>> a = '000235.8'
>> print, (STREGEX(a, '(..)(..)(....)', /SUBEXPR, /extract))[1:*]
>> 00 02 35.8
>
> In other words, use perl...

a = '000235.8'
b = byte(a)
print, string(b[0:1]), ' ', string(b[2:3]), ' ', string(b[4:*])

Eat your heart out, Perl...

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Read Total lines in an ASCII file
Next Topic: Large widget identifiers

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 29 01:55:30 PST 2020

Total time taken to generate the page: 0.00586 seconds