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

Home » Public Forums » archive » Re: Removing (or replacing) substrings in a string array
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: Removing (or replacing) substrings in a string array [message #84595] Wed, 22 January 2014 08:36
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den onsdagen den 22:e januari 2014 kl. 16:57:50 UTC+1 skrev Fabien:
> ... if I might sneak into this post: is there a general solution for the
> problem:
>
> "Removing (or replacing) all occurences of a substring of any length in
> a string array" ?
>
> This sounds like such a trivial and usefull operation that I wonder why
> it is not native in the IDL language...
>
> I rely on this solution which I found on the newsgroup:
>
> https://groups.google.com/d/msg/comp.lang.idl-pvwave/4eq9yOP NTJ8/mDltqt72pogJ
>
> There is also the Astro solution:
>
> http://www.astro.washington.edu/docs/idl/cgi-bin/getpro/libr ary27.html?STRREPLACE
>
> But it would be nice to have a unified and fast solution, no?
>
> Is there one already?
>
> Thanks!

Looks like it would be possible to do this with the regular subexpressions. Instead of keeping the matching row in the 2D array that you get from stregex, you should be able to piece together all the other parts, optionally with a string replacing that row instead of removing it.

If it's fast I don't know. But at least it's not loop based like strreplace
[Message index]
 
Read Message
Previous Topic: cgImage in PostScrpt files
Next Topic: keyword inheritance question

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

Current Time: Wed Oct 08 11:30:21 PDT 2025

Total time taken to generate the page: 0.00427 seconds