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

Home » Public Forums » archive » Re: Code cluttered with 'STRTRIM(variable,2)' ?
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: Code cluttered with 'STRTRIM(variable,2)' ? [message #5005] Fri, 15 September 1995 00:00 Go to previous message
twf is currently offline  twf
Messages: 2
Registered: May 1995
Junior Member
In article <43a0h0$fq5@post.gsfc.nasa.gov>, thompson@orpheus.nascom.nasa.gov (William Thompson) writes:
|>Russ Welti <rwelti@chroma.mbt.washington.edu> writes:
|>
|>>A nit that has plagued me since day 1 in IDL is:
|>
|>>What is the best way to formulate strings which contain
|>>variables' values without getting all cluttered up with
|>>strtrim(variable,2) ?? This really uglifies my code.
|>
|>>Example:
|>
|>>>msg=$
|>>>'Warning: '+strtrim(n_sizes,2)+' size combinations fitted against '+$
|>> strtrim(n_peaks,2)+' peak combinations means '+ $
|>> strtrim(n_sizes*n_peaks,2)+' individual curve fits will be done.'
|>>>print,msg
|>
|>One way to do it would be to use the STRCOMPRESS function, which converts
|>multiple spaces in a string to a single space. However, this doesn't really
|>help in your example because you'd still have to convert the integers to
|>string. Thus,
|>
|> msg=strcompress($
|> 'Warning: '+string(n_sizes)+' size combinations fitted against '+$
|> string(n_peaks)+' peak combinations means '+ $
|> string(n_sizes*n_peaks)+' individual curve fits will be done.')
|> print,msg
|>
|>isn't much better.
|>
Following up on Bill's strcompress suggestion, how about:

msg=strcompress(string($
'Warning: ',n_sizes,' size combinations fitted against ',$
n_peaks,' peak combinations means ', $
n_sizes*n_peaks,' individual curve fits will be done.'))
print,msg

-tom fredian
twf@pfc.mit.edu
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL and Windows 95
Next Topic: Please help! Want N-D wavelets in PV-WAVE

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

Current Time: Wed Oct 08 15:31:49 PDT 2025

Total time taken to generate the page: 0.00470 seconds