Re: split() function (like perl's) - Reply

new topic     » goto parent     » topic index » view thread      » older message » newer message

>While I did not test either split solution offered yet, it seems that Ralf
>has the better idea. The de-limiter may not be an integer. It may be, as is
>common, a quote-comma-qoute combination as in an exported data file or a
>period-space combination as in a string that was a series of sentences.


Those are two different things though..
split (". ", "Sentence 1. Sentence 2")

Will return {"Sentence 1. Sentence 2"}

Because it still compares ". " with every element of "Sentence 1.Sentence 2"
To split them in such case, would be: "Sentence 1" & {". "} & "Sentence 2"

Also, I made a (very common) mistake to assume compare returns true when
they are equal.. so here is the split () and split_match (). Tested and with
a short example. They're attached.

You should be able to get documentation from the comment by using NiceForm
/D
However, I didn't get it to work..

Ralf



begin 666 Splits.e
M("AN:65U=V5N0'AS-&%L;"YN;"D-"BTM(%5S92!.:6-E1F]R;2 O9"!S<&QI
M(&$@8V]S="!O9B Q,S S-#(S,#0Y,S0S,R!54RX@) T*#0IF=6YC=&EO;B!S
M<&QI=" H;V)J96-T('@L('-E<75E;F-E(',I#0H@("TM+R!5<V%G93H@<R ]
M('-P;&ET("AD96QI;6ET97(L('-E<75E;F-E*0T*(" M+2\@5&AE('-E<75E
M('1H92!D96QI;6ET97(-"B @+2TO(%1H92!D96QI;6ET97(@;V)J96-T(&ES
M90T*(" M+2\@06QL('!I96-E<R!A<F4@<F5T=7)N960@:6X@;VYE('-E<75E
M;F-E#0H-"B @<V5Q=65N8V4@<F5T#0H@(&EN=&5G97(@<&]S+"!P<F5V#0H-
M"B @<F5T(#T@>WT-"B @<')E=B ](#$-"B @<&]S(#T@9FEN9" H>"QS*0T*
M("!W:&EL92!P;W,@9&\-"B @("!R970@/2!A<'!E;F0H<F5T+"!S6W!R978N
M+G!O<UTI#0H@(" @<')E=B ]('!O<R K(#$-"B @("!P;W,@/2!F:6YD*'@L
M('-;<')E=BXN;&5N9W1H*',I72D-"B @96YD('=H:6QE#0H-"B @<F5T=7)N
M;@T*#0IF=6YC=&EO;B!S<&QI=%]M871C:" H;V)J96-T('@L('-E<75E;F-E
M(',I#0H@("TM+R!5<V%G93H@<R ]('-P;&ET7VUA=&-H("AD96QI;6ET97(L
M('-E<75E;F-E*0T*(" M+2\@5&AE('-E<75E;F-E("AS96-O;F0@87)G*2!W
M:6QL(&)E(&1I=FED960@:6X@<&EE8V5S(&)Y('1H92!D96QI;6ET97(-"B @
M;GD@<V5C=&EO;B!O9B!T:&4@<V5Q=65N8V4-"B @+2TO($%L;"!P:65C97,@
M= T*("!I;G1E9V5R('!O<RP@<')E=@T*#0H@(')E=" ]('M]#0H@('!R978@
M/2 Q(" @(" -"B @:68@871O;2AX*2!T:&5N('@@/2![>'T@96YD(&EF#0H@
M('!O<R ](&UA=&-H("AX+',I#0H@('=H:6QE('!O<R!D;PT*(" @(')E=" ]
M(&%P<&5N9"AR970L('-;<')E=BXN<&]S72D-"B @("!P<F5V(#T@<&]S("L@
M;&5N9W1H*'@I#0H@(" @<&]S(#T@9FEN9"AX+"!S6W!R978N+FQE;F=T:"AS
C978N+FQE;F=T:"AS*5TI#0IE;F0@9G5N8W1I;VX-"@T*#0H`
`
end

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu