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 #5007 is a reply to message #5005] Thu, 14 September 1995 00:00 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
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.

> I guess possible solutions include defining a 'wrapper' for
> strtrim, like:

> FUNCTION str,s
> return,strtrim(s,2)
> END

That's basically what I do.

Bill Thompson
[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 19:21:49 PDT 2025

Total time taken to generate the page: 0.00415 seconds