[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string manipulation



JD Smith <jdsmith@astro.cornell.edu> writes:
> Craig Markwardt wrote:
... deleted ...
> > I am able to find the string positions of the 2's, so that's not
> > really a problem.  I do this by making a byte array of the strings,
> > and blanking out any alphabetic characters and any leading numeric
> > characters.  Here I appreciate STRPOS is (partially) vectorized.
> > 
> > However, when it comes to resubstituting the "50" back in, that's when
> > I get stymied.  This is primarily because STRMID and STRPUT are not
> > vectorized at all.  Well STRMID *is* vectorized, but not with a sane
> > behavior.  For example, what I'd like to do is:
> > 
> > NEWKEY = STRMID(KEY,0,P1) + '50' + STRMID(KEY,P2,100)
> > 
> > Where KEY, P1, and P2 are vectors.  Obviously this doesn't work.  Any
> > ideas?
> 
> I was going to come up with something using histogram, but I figured I'd
> be pressing my luck.  I would probably use a loop and the
> sx{add,del,}par.pro routines from the nasalib.  FITS has lots of rules
> about keyword length, total line length, etc.  Best to waste some cycles
> and make sure it's done right.

Jah, that's what I do now, except I know they are valid header
keywords already, since they come from an already-existing file, and
I'd like to preserve the original formatting as much as possible.  But
I guess a loop is just necessary.

[ I was looking for the magic HISTOGRAM bullet too ... ]

Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------