As of VA Smalltalk 9.1, a stream auto-detects the line delimiter when using the nextLine method. Prior to this behavior, the stream would use the platform line delimiter which made it difficult to create multiline string content on one platform that could be seamlessly read on another with nextLineThe platform file system's line delimiter for cr is used by default. A string representing the current line delimiter can be obtained by sending the lineDelimiter message to a file stream instance and can be changed to an arbitrary string by sending the lineDelimiter: message. This makes it possible to enforce a specific line delimiter, such as always writing out the Windows line delimiter default, CrLf, for certain socket protocols even though you might be on Linux. The following table lists the line delimiter constants defined in the CldtConstants pool dictionary:
The following example demonstrates the use of the lineDelimiter: message and line delimiter constants, as well as their effect on the cr message:As of 9.1, you no longer need to choose Cr, Lf or CrLf for nextLine as the stream auto-detects the line ending. Use upToAll: and skipToAll: to scan up to various special character sequences. This is better than changing the line delimiter to the special sequence with lineDelimiter: and then using nextLine.
![]() |