Re: program directory
- Posted by "Boehme, Gabriel" <gboehme at MUSICLAND.COM> Apr 27, 1999
- 547 views
Whoops, the old code remnant strikes again! My parse() function was unnecessarily using a separate variable for the list sequence length. Here's the "corrected" function: ------------------------------------------------------------------------ function parse(sequence s, object x) -- parse s based on delimiter x into a sequence of values -- NOTE: we append x to s so we have at least one delimiter, at the end sequence list integer prev, curr list = find_all(x, append(s, x)) -- list of delimiter positions prev = 0 for i = 1 to length(list) do curr = list[i] list[i] = s[prev+1..curr-1] prev = curr end for return list -- now, a list of the delimited values end function ------------------------------------------------------------------------ The rest of the functions should be just fine. Please note that find_last(), find_all() and parse() are general-purpose routines which can be used for many other purposes. Be seeing you, Gabriel Boehme ------ Most modern freedom is at root fear. It is not so much that we are too bold to endure rules; it is rather that we are too timid to endure responsibilities. G.K. Chesterton ------