Nice! :-D Follows the KISS principle perfectly!

--�
Cheers,
Peter

On Tue, May 4, 2010 at 12:08 PM, Oscar Nierstrasz <oscar@iam.unibe.ch> wrote:

Ah! �Now, I get it.

What about this?

'''''' join: ('''' split: 'don''t') -> 'don''''t'

Not as efficient as using a stream, but pretty simple.

- on


On May 4, 2010, at 10:54 , Peter Hugosson-Miller wrote:

> Oscar, you should think of the question as: "what is the simplest piece of code that could take your string ('''''', which has two quotes in it) and return a new one with four quotes in it instead of two?"
>
> --
> Cheers,
> Peter
>
> On Tue, May 4, 2010 at 10:33 AM, Oscar Nierstrasz <oscar@iam.unibe.ch> wrote:
>
> s := ''''''.
> s size -> 2
>
> works fine for me. am i missing something?
>
> - on
>
>
>
> On May 3, 2010, at 22:54 , Schwab,Wilhelm K wrote:
>
> > Stef,
> >
> > First, try #printString - it might do the job for you. �Failing that, you can do something like
> >
> > | out |
> > out := WriteStream on:String new.
> > self do:[ :c |
> > �c = $' ifTrue:[ out nextPut:$' ].
> > �out nextPut:c.
> > ].
> > ^out contents.
> >
> > I'll be interested to see all of the better ways to do this.
> >
> > Bill
> >
> >
> > -----Original Message-----
> > From: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of St�phane Ducasse
> > Sent: Monday, May 03, 2010 3:48 PM
> > To: Pharo Development
> > Subject: [Pharo-project] how to simply double a ' inside string
> >
> > Does anybody know how to double a ' inside a string?
> >
> > Stef
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project@lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project@lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project