Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Building an Associate List from a string

From: andrew:martin:colenso:school at: 24-Dec-2003 22:42

Earlier I wrote:
> You need to put the above into a function and make 'Word and 'Value
into local words and take out 'probe-s. Something like this: Rebol [] Test: "age^-54^-name^-Tim Johnson^-occupation^-coder^-Salary^-USD$100000.00" Parse-List: function [String [string!] /With Delimiter [string! char!]] [Block Word Value] [ Delimiter: any [Delimiter tab] Block: copy [] all [ parse/all String [ some [ copy Word to Delimiter skip (Word: to word! Word) [ copy Value integer^ (Value: to integer! Value) | copy Value money^ (Value: to money! Value) | copy Value [to Delimiter | to end] ] ( insert tail Block reduce [Word Value] ) [Delimiter | end] ] end ] Block ] ] probe parse-list Test halt Which returns: [age 54 name "Tim Johnson" occupation "coder" Salary USD$100000.00] Andrew J Martin Bored Attendance Officer Speaking in tongues and performing miracles Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]