[Newbies] Parsing and splitting file contents
ennoausberlin at mac.com
Sat Aug 29 14:00:35 UTC 2009
Am 29.08.2009 um 15:48 schrieb r00t uk <r00tuk at gmail.com>:
> Ok, I am new to smalltalk. I have tried browsing and searching for
> methods related to parsing and splitting file contents based on a
> delimiter, but I am not having much success. :( Old google is not
> helping either so I can only assume that I am missing something
> 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
> I was hoping there was going to be something like:
> Bag := FileStream collect: [:x | split: crlf].
> Dictionary := Bag collect: [:x | split: tab].
> Does that make any sense? Basically create Bag with contents of
> FileStream split by crlf and then split Bag elements by tab into key
> value pairs.
> 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. The language may be easy, but finding which
> methods to use to solve problems is a bit laborious.
> Thanks in advance.
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners