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

Home » Public Forums » archive » Code cluttered with 'STRTRIM(variable,2)' ?
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
Code cluttered with 'STRTRIM(variable,2)' ? [message #5010] Wed, 13 September 1995 00:00
Russ Welti is currently offline  Russ Welti
Messages: 27
Registered: October 1994
Junior Member
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

I have played with PRINT,STRING(FORMAT='( . . . )',<stuff>)

but that is not really very nice to look at either and is a pain
to maintain the format spec if the output changes slightly.

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

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

Any thoughts? Am I missing an easy way?

I think the default, for a function called stringTRIM, should be
to trim both ends, so at least I would not need to pass that pesky 2. ;)
/
Russ Welti /-\
(c-g)
University of Washington \-/
Molecular Biotechnology /
PO Box 352145 /-\
Seattle, WA 98195 (a-t)
rwelti@u.washington.edu \-/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: wavelet software for idl
Next Topic: Re: Plot titles

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

Current Time: Sat Oct 11 11:03:51 PDT 2025

Total time taken to generate the page: 0.72075 seconds