Re: handling numbers [message #33177] |
Fri, 13 December 2002 09:30  |
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  |
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!
|
|
|