Parsing
[1/7] from: ptretter::norcom2000::com at: 24-Jan-2001 20:25
Parsing should be enhanced with an option to return a string datatype!. Everyone that
has dealt with REBOL for a length of time has come across the problem of needing to do
the following:
at series index
the problem is that parsing returns a block! datatype. Anyone know if this will be changed
in future /Core revisions?
Paul Tretter
After all Simple things should be simple to do!
[2/7] from: al:bri:xtra at: 25-Jan-2001 16:07
Paul Tretter wrote:
> Parsing should be enhanced with an option to return a string datatype!.
Have you tried this:
rejoin parse "string" " "
?
> Everyone that has dealt with REBOL for a length of time has come across
the problem of needing to do the following:
> at series index
What would be a simpler way?
> the problem is that parsing returns a block! datatype.
'parse chops one thing (a string!) into many things. A block is ideal for
storing most things, while hash! and list! cover the rest.
> Anyone know if this will be changed in future /Core revisions?
I'm sure I misunderstand your intent. Could you give an example, please?
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
-><-
----- Original Message -----
From: "Paul Tretter" <[ptretter--norcom2000--com]>
To: <[rebol-list--rebol--com]>
Sent: Thursday, 25 January 2001 3:25 PM
Subject: [REBOL] Parsing
> Parsing should be enhanced with an option to return a string datatype!.
Everyone that has dealt with REBOL for a length of time has come across the
problem of needing to do the following:
[3/7] from: ptretter:norcom2000 at: 24-Jan-2001 22:19
Andrew,
You example didnt work in my case. I am trying to take a and obtain the
rest of the string starting at index 4.
Problem is that Parse returns a block. And in your example it still
produced the same problem of condensing the string so that a string of "This
is a test" turns out as "Thisisatest"
Paul Tretter
[4/7] from: al:bri:xtra at: 25-Jan-2001 17:45
Hi, Paul, you wrote:
> You example didn't work in my case. I am trying to take a and obtain the
rest of the string starting at index 4.
Have you tried:
>> copy/part at "This part" 6 4
== "part"
> Problem is that Parse returns a block.
It needs to as parse turns one thing into many things.
> And in your example it still produced the same problem of condensing the
string so that a string of "This is a test" turns out as "Thisisatest"
That's what rejoin does. Try 'reform to get a space in between. Like:
>> reform parse "axstringxwithxspaces" "x"
== "a string with spaces"
Can you give an example of input and output? I'm sure I'm still
misunderstanding you.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[5/7] from: rebol:techscribe at: 25-Jan-2001 1:13
Hi Andrew,
aren't you being a little verbose ;-)?
>> at "This part" 4
will give you the substring, which is all Paul really asked for. To
avoid modifying the original string you may want to add
>> copy at "This part" 4
Paul's example does not prescribe extracting an embedded substring, and
therefore you don't really need to use the /part refinement. Probably
you wanted to show Paul how to extract a string that ends before the end
of the source string?
Take Care,
Elan
Andrew Martin wrote:
[6/7] from: al:bri:xtra at: 25-Jan-2001 22:39
Elan joked:
> [Andrew] aren't you being a little verbose ;-)?
That's me, just foaming at the mouth. :-)
Andrew Martin
Rabid rebol...
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[7/7] from: ptretter:norcom2000 at: 25-Jan-2001 9:13
Thanks Andrew it was the 'reform function that I needed to make my script
work.
Paul Tretter