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

Home » Public Forums » archive » string manipulation
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: string manipulation [message #23966 is a reply to message #23898] Tue, 27 February 2001 13:29 Go to previous message
landsman is currently offline  landsman
Messages: 93
Registered: August 1991
Member
In article <on66hxm5tk.fsf@cow.physics.wisc.edu>, craigmnet@cow.physics.wisc.edu writes...
> 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)
> NEWKEY = STRMID(KEY,0,P1) + '50' + STRMID(KEY,P2,100)
>
> Where KEY, P1, and P2 are vectors. Obviously this doesn't work. Any
> ideas?

The problem when STRMID was vectorized for V5.3 was that it was made *too*
powerful -- it handles simultaneously both extraction from multiple strings
and multiple extractions from a single string. In practice, I think the
first situation -- extraction from multiple strings -- is far more common, but
has an ugly syntax in the current STRMID implementation. Here is how one
does the example above.

N = N_elements(KEY)
NEWKEY = STRMID(KEY,INTARR(1,N),REFORM(P1,1,N)) + '50' + $
STRMID(KEY,REFORM(P2,1,N), REPLICATE(100,1,N) )

I have thought about writing a simple wrapper around STRMID (say STRMIDV) that
would have a simpler syntax for the case of single extractions from
multiple strings.

--Wayne Landsman landsman@mpb.gsfc.nasa.gov
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MPEG and IDL 5.4
Next Topic: Re: IDLgrLegend geometry

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

Current Time: Fri Oct 10 07:08:19 PDT 2025

Total time taken to generate the page: 1.03801 seconds