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

Home » Public Forums » archive » How to eliminate trailing zeros in a string?
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
How to eliminate trailing zeros in a string? [message #33807] Fri, 24 January 2003 13:27 Go to next message
K Banerjee is currently offline  K Banerjee
Messages: 14
Registered: September 2001
Junior Member
Folks,

Say I have the string "20.304000". How can I eliminate the last 3
zeros?

Thanks.

K. Banerjee
Re: How to eliminate trailing zeros in a string? [message #33839 is a reply to message #33807] Fri, 31 January 2003 10:40 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
K Banerjee wrote:

> Folks,
>
> Say I have the string "20.304000". How can I eliminate the last 3
> zeros?
>
> Thanks.
>
> K. Banerjee

Dear K


we have a routine in our library named number_format which is able to print
numbers without the fullfillings of 0.

http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/number_format.tar.gz
or as idl binary
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/number_format.sav

print,number_format(20.304000)
20.304

You can use this routine to format an array of numbers to the same length
too.

a=[20.1,20.134,8.98]
print,transpose(number_format(a))
20.100
20.134
8.980


Further routines and licensing you find here
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html


best regards


Reimar

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Alpha Blending inside of Widgets / Graphic Objects in Widgets
Next Topic: Re: How to add 'd' to get the correct julian conversion ?

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

Current Time: Wed Oct 08 16:50:00 PDT 2025

Total time taken to generate the page: 0.00539 seconds