Replace substring with

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Replace substring with

Andres Fortier-2
Hi list,
         a couple of times I have to perform replacements of substrings
and I couldn't find a standard solution.  By replacing substrings I mean
something like replacing 'xy' with 'werty' in 'xyer sd xy' (and not
something like '..<1s>..' expandMacrosWith:...). I thought that maybe
the replace dialog from paragraph editor may give a hint, but it turns
out it is implemented in the controller itself. So I was just wondering,
before writing it, if I was missing something in the base image or if
anybody already wrote it?

Thanks in advance,
                   Andrés

Reply | Threaded
Open this post in threaded view
|

RE: Replace substring with

mark.b.ballard
SequenceableCollection copyReplaceAll:with: {copying}

-----Original Message-----
From: Andres Fortier [mailto:[hidden email]]
Sent: Friday, August 24, 2007 11:13 AM
To: VWNC List
Subject: Replace substring with


Hi list,
         a couple of times I have to perform replacements of substrings
and I couldn't find a standard solution.  By replacing substrings I mean
something like replacing 'xy' with 'werty' in 'xyer sd xy' (and not
something like '..<1s>..' expandMacrosWith:...). I thought that maybe
the replace dialog from paragraph editor may give a hint, but it turns
out it is implemented in the controller itself. So I was just wondering,
before writing it, if I was missing something in the base image or if
anybody already wrote it?

Thanks in advance,
                   Andrés

Reply | Threaded
Open this post in threaded view
|

Re: Replace substring with

Andres Fortier-2
I guess I *was* missing something. Thanks!

 > SequenceableCollection copyReplaceAll:with: {copying}

>
> -----Original Message-----
> From: Andres Fortier [mailto:[hidden email]]
> Sent: Friday, August 24, 2007 11:13 AM
> To: VWNC List
> Subject: Replace substring with
>
>
> Hi list,
>          a couple of times I have to perform replacements of substrings
> and I couldn't find a standard solution.  By replacing substrings I mean
> something like replacing 'xy' with 'werty' in 'xyer sd xy' (and not
> something like '..<1s>..' expandMacrosWith:...). I thought that maybe
> the replace dialog from paragraph editor may give a hint, but it turns
> out it is implemented in the controller itself. So I was just wondering,
> before writing it, if I was missing something in the base image or if
> anybody already wrote it?
>
> Thanks in advance,
>                    Andrés
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Replace substring with

Andre Schnoor
In reply to this post by Andres Fortier-2
Check out "Regex11" package and look for

CharacterArray>>copyWithRegex: rxString matchesReplacedWith: aString

HTH
Andre


Andres Fortier schrieb:

> Hi list,
>         a couple of times I have to perform replacements of substrings
> and I couldn't find a standard solution.  By replacing substrings I
> mean something like replacing 'xy' with 'werty' in 'xyer sd xy' (and
> not something like '..<1s>..' expandMacrosWith:...). I thought that
> maybe the replace dialog from paragraph editor may give a hint, but it
> turns out it is implemented in the controller itself. So I was just
> wondering, before writing it, if I was missing something in the base
> image or if anybody already wrote it?
>
> Thanks in advance,
>                   Andrés
>
>

--
Andre Schnoor
Cognitone GmbH
www.cognitone.com


Reply | Threaded
Open this post in threaded view
|

Re: Replace substring with

Andres Fortier-2
Thanks Andre, I guess regular expressions will do a better job than
copyReplaceAll:with: in this particular case.

Andrés

Andre Schnoor escribió:

> Check out "Regex11" package and look for
>
> CharacterArray>>copyWithRegex: rxString matchesReplacedWith: aString
>
> HTH
> Andre
>
>
> Andres Fortier schrieb:
>> Hi list,
>>         a couple of times I have to perform replacements of substrings
>> and I couldn't find a standard solution.  By replacing substrings I
>> mean something like replacing 'xy' with 'werty' in 'xyer sd xy' (and
>> not something like '..<1s>..' expandMacrosWith:...). I thought that
>> maybe the replace dialog from paragraph editor may give a hint, but it
>> turns out it is implemented in the controller itself. So I was just
>> wondering, before writing it, if I was missing something in the base
>> image or if anybody already wrote it?
>>
>> Thanks in advance,
>>                   Andrés
>>
>>
>