Talk:Multisplit: Difference between revisions
Content added Content deleted
(→F# incorrect: new section) |
|||
Line 221: | Line 221: | ||
This gives us the "tail end" -- everything appearing after the last valid separator (or the entire argument string if none were valid). Since there is no separator terminating this instance, I use an empty value to represent its details. |
This gives us the "tail end" -- everything appearing after the last valid separator (or the entire argument string if none were valid). Since there is no separator terminating this instance, I use an empty value to represent its details. |
||
== F# incorrect == |
|||
In this part of the F# example, you can see that it is incorrect: |
|||
<lang fsharp>> "a!===b=!=c".Split([|"="; "!="; "=="|], System.StringSplitOptions.None);; |
|||
val it : string [] = [|"a"; ""; ""; "b"; ""; "c"|]</lang> |
|||
"a!===b=!=c" should be split like this (because of the order of the delimeters): |
|||
a!, =, =, =, b, =, !, =, c |
|||
"=" comes first in the delimeters list. <nowiki>"!=" should never be matched because the "=" has already been matched by the first delimeter in the list. If "!=" could be matched before "=", then the order of the delimeters wouldn't matter. Since the order matters, you scan for "=" first.</nowiki> --[[User:Mwn3d|Mwn3d]] 18:50, 21 April 2011 (UTC) |