string manipulation question

Robert Haussmann haussma at nextdimension.net
Fri Dec 10 17:31:15 PST 2004


> Robert Haussmann wrote:
> > 
> > I'm sure there is probably a very easy way to do the
> > following, but it eludes me at the moment.  How
> > can I take a string, and replace every instance of
> > one character (a single quotation mark) with two
> > characters (two single quotes)?
> > 
> > In other words:
> >         O'Brian becomes O''Brian
> >         O'Brian's becomes O''Brian''s
> 
> As long as you don't want to computer two quotes into four, use the
> following edit:
> 
>     { {!" "!}@ | "'"<"'"> | * }
> 
> This will convert one single-quote into two, and it will leave two
> single-quotes as two.
> 

Now that is pure genius.  Very elegant--thank you.

Bob



More information about the Filepro-list mailing list