more? parse
[1/4] from: Rebolinth:nodep:dds:nl at: 29-Jul-2003 16:37
..Struggling...
With my experiences on the 'find function i moved towards 'parse for better
string handling.(pfffiew what a relief ;-) As it seemed in the first place...
According to the examples in [ http://www.rebol.com/docs/core23/rebolcore-
15.html#sect10.5. ] it should be possible to find characters inside a string.
oke lets try:
>> probe parse "thisisaverylongstringwhichcouldbeusedbyparse" "very"
== ["thisisa" "" "" "" "longst" "ingwhichcouldb" "us" "db" "pa" "s"]
>> parse/all "thisisaverylongstringwhichcouldbeusedbyparse" {"very"}
== ["thisisa" "" "" "" "longst" "ingwhichcouldb" "us" "db" "pa" "s"]
>> probe parse "thisisaverylongstringwhichcouldbeusedbyparse" [ thru "isa"
to "long" ]
== false
Very intresting...but not what i expected...
(I'm searching for characters inside a string...? or not?)
As it seems, a string inside 'parse is a collection of characters seperated
by white-space. (Which is more related to the human way of reading instead of
the logic of computer-data anyway but oke...)
Is it possible anyway?
Im expecting to be hit very hard here ;-) so hit me...
perhpas a native! extention on parse?
(R)egards,
Norman.
--
Conversation/lunch: "How do you Eat your Rebol in the Morning?"
[2/4] from: Rebolinth::nodep::dds::nl at: 29-Jul-2003 16:57
Mmmmm i just got hit by my own stupidness !!..hehehe..always fun..
a string is a string when a string is a rebol string..
probe parse {"thisisaverylongstringwhichcouldbeusedbyparse"} "very"
Returns nicely..
(R)egards,
Norman.
[3/4] from: g:santilli:tiscalinet:it at: 29-Jul-2003 17:45
Hi Rebolinth,
On Tuesday, July 29, 2003, 4:37:36 PM, you wrote:
R> With my experiences on the 'find function i moved towards 'parse for better
R> string handling.(pfffiew what a relief ;-) As it seemed in the first place...
R> According to the examples in [ http://www.rebol.com/docs/core23/rebolcore-
R> 15.html#sect10.5. ] it should be possible to find characters inside a string.
I think I don't understand what you want to do...
>>> probe parse "thisisaverylongstringwhichcouldbeusedbyparse" "very"
R> == ["thisisa" "" "" "" "longst" "ingwhichcouldb" "us" "db" "pa" "s"]
>>> parse/all "thisisaverylongstringwhichcouldbeusedbyparse" {"very"}
R> == ["thisisa" "" "" "" "longst" "ingwhichcouldb" "us" "db" "pa" "s"]
Used this way, PARSE splits your string based on the delimiters
you give as the second argument.
>>> probe parse "thisisaverylongstringwhichcouldbeusedbyparse" [ thru "isa"
R> to "long" ]
R> == false
Here, PARSE applies the rule given as its second argument to the
string. The rule does not reach the end of the string, so PARSE
returns false.
Maybe you just wanted this?
>> find "thisisaverylongstringwhichcouldbeusedbyparse" "very"
== "verylongstringwhichcouldbeusedbyparse"
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[4/4] from: brett:codeconscious at: 30-Jul-2003 10:11
This has a few examples:
http://www.codeconscious.com/rebol/parse-tutorial.html
Brett.