line-feed or carriage-return

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

line-feed or carriage-return

Christoph J. Bachinger
I have this method in my old Smalltalk,
and wanted to implement it in Dolphin,
at the class Stream.


nextLine
         "Answer a String consisting of the characters of
          the receiver up to the next line delimiter
          (line-feed or carriage-return line-feed)."
     | line |
     line := self upTo: Lf.
     line size > 0 ifTrue: [
         (line at: line size) == Cr
             ifTrue: [^line copyFrom: 1 to: line size - 1]].
     ^line

--> Error: undeclared 'Lf'
is coming

Can you help me,
what line-feed Lf and carriage-return Cr is in Dolphin?

Or is there an equal method for nextline in Dolphin?

Thank you,
Katjana


Reply | Threaded
Open this post in threaded view
|

Re: line-feed or carriage-return - It's been solved.

Christoph J. Bachinger
It's been solved.

:)
Katjana

Katjana T. schrieb:

> I have this method in my old Smalltalk,
> and wanted to implement it in Dolphin,
> at the class Stream.
>
>
> nextLine
>         "Answer a String consisting of the characters of
>          the receiver up to the next line delimiter
>          (line-feed or carriage-return line-feed)."
>     | line |
>     line := self upTo: Lf.
>     line size > 0 ifTrue: [
>         (line at: line size) == Cr
>             ifTrue: [^line copyFrom: 1 to: line size - 1]].
>     ^line
>
> --> Error: undeclared 'Lf'
> is coming
>
> Can you help me,
> what line-feed Lf and carriage-return Cr is in Dolphin?
>
> Or is there an equal method for nextline in Dolphin?
>
> Thank you,
> Katjana
>


Reply | Threaded
Open this post in threaded view
|

Re: line-feed or carriage-return

Ian Bartholomew-18
In reply to this post by Christoph J. Bachinger
Katjana,

> Can you help me,
> what line-feed Lf and carriage-return Cr is in Dolphin?

Use the class side methods in the Character class

Lf == Character lf
Cr == Character cr

> Or is there an equal method for nextline in Dolphin?

SequencedStream>>nextLine

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: line-feed or carriage-return

Roberto Lupi-2
In reply to this post by Christoph J. Bachinger
In article <[hidden email]>,
[hidden email] says...
> Can you help me,
> what line-feed Lf and carriage-return Cr is in Dolphin?

Character lf and Character cr.

> Or is there an equal method for nextline in Dolphin?

Sure, it's called nextLine; BTW it is defined in the
ReadStream protocol and it is part with the ANSI
Smalltalk standard. You'll find nextLine in any mayor
Smalltalk implementation.

--
Roberto Lupi


Reply | Threaded
Open this post in threaded view
|

Re: line-feed or carriage-return

Roberto Lupi-2
In reply to this post by Christoph J. Bachinger
In article <[hidden email]>,
[hidden email] says...
> Can you help me,
> what line-feed Lf and carriage-return Cr is in Dolphin?

Character lf and Character cr.

> Or is there an equal method for nextline in Dolphin?

Sure, it's called nextLine; BTW it is defined in the
ReadStream protocol and it is part of the ANSI
Smalltalk standard. You'll find nextLine in any
Smalltalk implementation.

--
Roberto Lupi