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

Home » Public Forums » archive » Re: How to eliminate trailing zeros in a string?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to eliminate trailing zeros in a string? [message #33798] Sat, 25 January 2003 10:35 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:
>
> Alright, I've thought about it a little bit. How about this:
>
> IDL> str = '20.304000'
> IDL> str = String(str, Format='(F6.3)')
> IDL> Print, str
> 20.304

How about this variation on David's technique, but satisfies James's
requirement of an arbitrary number of zeroes:

print, string(str, format='(G0)')

The "G0" format usually renders a number in its most compact form.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDLgrWindow, IDLgrVolume and alpha channel
Next Topic: MOUSE (WHEEL) BUTTON NON-STOP SCROLLING IN IDL 5.6

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

Current Time: Fri Oct 10 09:32:12 PDT 2025

Total time taken to generate the page: 3.27948 seconds