How to get a Newline Character

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

How to get a Newline Character

Felix Dorner
Hi,

I couldn't find anything about how to display special characters. It
seems like there's no escape mechanism inside literal strings, such as
(in java) "Hello \n World". Do I really have to represent this as:
'hello', String cr, 'world' ? I am aware that I can embed the newline
in the with, uhm, a newline like this: 'Hello
World'. I find this unsatisfactory, because often I am at a certain
indent level and don't want to place such fragments at the beginning
of a line.

Thanks,
Felix


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to get a Newline Character

Bert Freudenberg
Am 17.08.2008 um 14:41 schrieb Felix Dorner:

> Hi,
>
> I couldn't find anything about how to display special characters. It
> seems like there's no escape mechanism inside literal strings, such as
> (in java) "Hello \n World". Do I really have to represent this as:
> 'hello', String cr, 'world' ? I am aware that I can embed the newline
> in the with, uhm, a newline like this: 'Hello
> World'. I find this unsatisfactory, because often I am at a certain
> indent level and don't want to place such fragments at the beginning
> of a line.


'Hello\World' withCRs

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How to get a Newline Character

Michael Davies-3
In reply to this post by Felix Dorner
On Sun, Aug 17, 2008 at 2:41 PM, Felix Dorner <[hidden email]> wrote:

> Hi,
>
> I couldn't find anything about how to display special characters. It
> seems like there's no escape mechanism inside literal strings, such as
> (in java) "Hello \n World". Do I really have to represent this as:
> 'hello', String cr, 'world' ? I am aware that I can embed the newline
> in the with, uhm, a newline like this: 'Hello
> World'. I find this unsatisfactory, because often I am at a certain
> indent level and don't want to place such fragments at the beginning
> of a line.
>
In addition to #withCRs that Bert mentioned, there's also a set of
methods around #expandMacrosWithArguments: which also give tabs and
argument substitution eg:

'Hello <1s><n>Watch this<t><2p>' expandMacrosWithArguments: { 'Felix'. 'space'}.
gives
'Hello Felix
Watch this     "space"'

Cheers,
Michael
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners