Joshua 'Schwa' Gargus
schwa at cc.gatech.edu
Tue Apr 22 20:37:20 UTC 2003
On Tue, Apr 22, 2003 at 03:08:08PM -0500, Jimmie Houchin wrote:
> First here's my code from a workspace.
> | file fc ft t1 t2 oc |
> t1 _ '#EXTINF:'.
> t2 _ ',Alexander Scourby - '.
> oc _ OrderedCollection Collection new.
> file _ FileList2 modalFileSelector.
> fc _ file contentsOfEntireFile.
> file close.
> ft _ fc findTokens: t1.
> ft inspect.
> Yes, I know, t2 and oc currently are unused.
> 1. I am creating a variable for the file contents and then discarding
> (closing) the file. Is that good form? Or would it be just as
> appropriate to assign the file contents into the file variable?
You're doing the right thing. Otherwise how would the file get closed?
> 2. The statement ft _ fc findTokens: t1. isn't doing what I want.
> It is however, doing what it claims. :)
Yes, it is doing what it claims. If you look at the code for findTokens:
you see that the argument is suggestively named "delimiters": this is a
collection of characters that are looked for to break up the input. I'm
guessing that you want to break up the input whereever whitespace is seen,
not whenever one of the characters #, E, X, T, I, N, F, : are seen.
ft _ fc findTokens: Character separators.
Hope this helps,
> I only want the exact string '#EXTINF:' as a token. I do not want it
> broken down into characters as tokens.
> Is there a way to do such?
> I have tried a variety of things including 'asSymbol' unsuccessfully.
> If 'findTokens:' cannot be used as such, then I can find other ways
> to accomplish my task. I just wanted to find out since it seems like a
> nice way of doing it.
> Not associated with the problem, but, can Squeak read/edit MP3 ID3 tags?
> Is there an editor? If not I wouldn't mind writing one as I learn. But I
> don't know how to read the tags from the file yet.
> Any help greatly appreciated.
> Jimmie Houchin
More information about the Squeak-dev