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

Home » Public Forums » archive » Re: IDL string trim
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: IDL string trim [message #61138] Mon, 07 July 2008 07:43 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <MPG.22daffe956a87f7598a3cb@news.frii.com>,
David Fanning <news@dfanning.com> wrote:
> RussellGrew writes:
>
>> This may not be the most elegant solution, but you can look at the
>> size of k and add an extra zero to the string manually.
>>
>> eg for the variable 'tmp' being slotted into the filename,
>>
>> if k lt 10. then tmp = '0' + strtrim(string(k), 2) else k =
>> strtrim(string(k), 2)
>>
>> I shall sit here and wait to be shot down by a more elegant solution.
>
> I think this might be the elegant solution you are looking for:
>
> strVal = String(k, Format='(i2.2)')
>
> Cheers,
>
> David

I usually use:

String(k, format='(I02)')

which seems a little more intuitive (the zero indicating to zero-pad the string) but produces the same results as David's.

--Mike


--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SHA-1, MD5, etc inquiry
Next Topic: Mapping image into a polar-square coordinate

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

Current Time: Wed Oct 08 14:52:03 PDT 2025

Total time taken to generate the page: 0.00493 seconds