[Newbies] Parsing and splitting file contents

K. K. Subramaniam subbukk at gmail.com
Sat Aug 29 14:29:04 UTC 2009


On Saturday 29 Aug 2009 7:18:02 pm r00t uk wrote:
> I am reading a tab delimited file into a string.  I want to iterate through
> this string and split by tab, or any other defined value (, . | # tab, cr,
> etc.), delimiter into substrings which are assigned to a Collection (Array,
> Dictionary, Bag, etc.), or instant variables.
See String>linesDo: and its senders. For parsing a line into tokens, you can 
use findTokens:

>Again, I am surprised by the lack of examples demonstrating to newbies how
>to perform basic operations such as this.  I know it is not the smalltalk
>way of learning, but it does raise the bar for making progress.
Searching source code is quite easy in Squeak. In this case, I used 
(Alt+Shift+W) to bring up the message search tool and searched for "lines". 
Then I used senders/implementers to explore methods.

HTH .. Subbu


More information about the Beginners mailing list