[REBOL] Parsing tab delimited text files Re:

2000-06-17 Thread ralph



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 17, 2000 12:29 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Parsing tab delimited text files
>
>
>  I am parsing a number of tab delimited text files.
>
>  For reasons unknown this doesn't work:
>
>  page: read/lines %textfile.txt
>  foreach line page [
> line: parse/all line tab
>  ]
>

Your problem is that tab is a character, i.e.:

>> print type? tab
char

The parse function is looking for a string, so just give it the tab as a
string value:

page: read/lines %textfile.txt
   foreach line page [
  line: parse/all line "^-"
   ]

and it will work like the true champ that REBOL is.

Enjoy.

--Ralph Roberts





[REBOL] Parsing tab delimited text files Re:

2000-06-16 Thread norsepower

>> probe tab
#"^-"
== #"^-" 

page: read/lines %textfile.txt
foreach line page [
line: parse/all line "^-"
]


> I am parsing a number of tab delimited text files.
>
> For reasons unknown this doesn't work:
>
> page: read/lines %textfile.txt
> foreach line page [
>line: parse/all line tab
> ]
>
> Instead, I do this:
> 
> parsetab: func [line] [
>replace/all line tab "|"
>line: parse/all line "|"
> ]
>
> foreach line page [
>line: parsetab line
> ]
>
> Why does the first way not work?
>
>
>