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

Home » Public Forums » archive » Re: 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
Re: handling numbers [message #33177] Fri, 13 December 2002 09:30 Go to next message
Richard Adams is currently offline  Richard Adams
Messages: 9
Registered: January 2000
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

a = '000235.8'
print, (STREGEX(a, '(..)(..)(....)', /SUBEXPR, /extract))[1:*]
00 02 35.8

This does something like that.

Cheers, Richard.


--
Richard J Adams e: rja46@cam.ac.uk
Department of Anatomy t: +44 1223 333750
University of Cambridge f: +44 1223 333786
Downing Street
Cambridge, CB2 3DY
UK
Re: handling numbers [message #33254 is a reply to message #33177] Fri, 13 December 2002 14:39 Go to previous message
wmconnolley is currently offline  wmconnolley
Messages: 106
Registered: November 2000
Senior Member
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...

-W.

--
William M Connolley | wmc@bas.ac.uk | http://www.nerc-bas.ac.uk/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
I'm a .signature virus! copy me into your .signature file & help me spread!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: OSX: syntax coloring?
Next Topic: Re: Proper use of assoc

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

Current Time: Wed Oct 08 14:53:04 PDT 2025

Total time taken to generate the page: 0.00424 seconds