[Pharo-users] String with: Character cr

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

[Pharo-users] String with: Character cr

jfabry
Hi all,

I am bulding some Strings to have nice textual representations of some  
of my objects. What is happening a lot is code like this:
self foo , ' in ', (String with: Character cr), self bar.

Is there some syntactic sugar for String with: Character cr to make  
these things nicer ?

--
Johan Fabry
[hidden email] - http://dcc.uchile.cl/~jfabry
PLEIAD Lab - Computer Science Department (DCC) - University of Chile




_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Marcus Denker-4

On Jan 25, 2010, at 4:16 PM, Johan Fabry wrote:

> Hi all,
>
> I am bulding some Strings to have nice textual representations of some  
> of my objects. What is happening a lot is code like this:
> self foo , ' in ', (String with: Character cr), self bar.
>
> Is there some syntactic sugar for String with: Character cr to make  
> these things nicer ?


 Character cr asString ?

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Mariano Martinez Peck


On Mon, Jan 25, 2010 at 4:19 PM, Marcus Denker <[hidden email]> wrote:

On Jan 25, 2010, at 4:16 PM, Johan Fabry wrote:

> Hi all,
>
> I am bulding some Strings to have nice textual representations of some
> of my objects. What is happening a lot is code like this:
> self foo , ' in ', (String with: Character cr), self bar.
>
> Is there some syntactic sugar for String with: Character cr to make
> these things nicer ?


 Character cr asString ?


String cr  ?

 

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Mariano Martinez Peck


On Mon, Jan 25, 2010 at 4:21 PM, Mariano Martinez Peck <[hidden email]> wrote:


On Mon, Jan 25, 2010 at 4:19 PM, Marcus Denker <[hidden email]> wrote:

On Jan 25, 2010, at 4:16 PM, Johan Fabry wrote:

> Hi all,
>
> I am bulding some Strings to have nice textual representations of some
> of my objects. What is happening a lot is code like this:
> self foo , ' in ', (String with: Character cr), self bar.
>
> Is there some syntactic sugar for String with: Character cr to make
> these things nicer ?


 Character cr asString ?


String cr  ?


I meant, self foo , ' in ', String cr, self bar.
 
 

--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users



_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

jfabry

On 25 Jan 2010, at 12:22, Mariano Martinez Peck wrote:

> String cr  ?
>
>
> I meant, self foo , ' in ', String cr, self bar.


Nice and short, that will do. Thanks Mariano, Marcus!

--
Johan Fabry
[hidden email] - http://dcc.uchile.cl/~jfabry
PLEIAD Lab - Computer Science Department (DCC) - University of Chile




_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Stefan Marr-4

On 25 Jan 2010, at 16:43, Johan Fabry wrote:
>> I meant, self foo , ' in ', String cr, self bar.
> Nice and short, that will do. Thanks Mariano, Marcus!
Well, thats not what I would call nice and short...
but its probably clean.

Isn't there anything better for throw away debug code? some like a nice and short (and pretty universal) '\n'?

Best
Stefan


> --
> Johan Fabry
> [hidden email] - http://dcc.uchile.cl/~jfabry
> PLEIAD Lab - Computer Science Department (DCC) - University of Chile
>
>
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users

--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 3956
Fax:   +32 2 629 3525


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Stéphane Ducasse

On Jan 25, 2010, at 5:21 PM, Stefan Marr wrote:

>
> On 25 Jan 2010, at 16:43, Johan Fabry wrote:
>>> I meant, self foo , ' in ', String cr, self bar.
>> Nice and short, that will do. Thanks Mariano, Marcus!
> Well, thats not what I would call nice and short...
> but its probably clean.
>
> Isn't there anything better for throw away debug code? some like a nice and short (and pretty universal) '\n'?

String lf :)

'\ ljkljk' withCrs

Stef

> Best
> Stefan
>
>
>> --
>> Johan Fabry
>> [hidden email] - http://dcc.uchile.cl/~jfabry
>> PLEIAD Lab - Computer Science Department (DCC) - University of Chile
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-users mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 3956
> Fax:   +32 2 629 3525
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Mariano Martinez Peck


On Mon, Jan 25, 2010 at 9:07 PM, Stéphane Ducasse <[hidden email]> wrote:

On Jan 25, 2010, at 5:21 PM, Stefan Marr wrote:

>
> On 25 Jan 2010, at 16:43, Johan Fabry wrote:
>>> I meant, self foo , ' in ', String cr, self bar.
>> Nice and short, that will do. Thanks Mariano, Marcus!
> Well, thats not what I would call nice and short...
> but its probably clean.
>
> Isn't there anything better for throw away debug code? some like a nice and short (and pretty universal) '\n'?

String lf :)

'\ ljkljk' withCrs

Cool! I wasn't aware of that one :)  A minor detail, it is '\ ljkl  \jk' withCRs

Upper case R :)
 

Stef

> Best
> Stefan
>
>
>> --
>> Johan Fabry
>> [hidden email] - http://dcc.uchile.cl/~jfabry
>> PLEIAD Lab - Computer Science Department (DCC) - University of Chile
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-users mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 3956
> Fax:   +32 2 629 3525
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] String with: Character cr

Adrian Kuhn
In reply to this post by jfabry
You can also just do the line-break in the string literal, ie

self foo , ' in
', self bar.

As an alternative you might also consider

'<1s> in<n><2s>' expandMacrosWith: self foo with: self bar

cheers,
AA



--
Follow me on http://twitter.com/akuhn