Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Multisplit/Wren/multisplit.wren
Normal file
13
Task/Multisplit/Wren/multisplit.wren
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import "/pattern" for Pattern
|
||||
import "/fmt" for Fmt
|
||||
|
||||
var input = "a!===b=!=c"
|
||||
var p = Pattern.new("[/=/=|!/=|/=]")
|
||||
var separators = p.findAll(input)
|
||||
System.print("The separators matched and their starting/ending indices are:")
|
||||
for (sep in separators) {
|
||||
System.print(" %(Fmt.s(-4, Fmt.q(sep.text))) between %(sep.span)")
|
||||
}
|
||||
var parts = p.splitAll(input)
|
||||
System.print("\nThe substrings between the separators are:")
|
||||
System.print(parts.map { |p| (p != "") ? Fmt.q(p) : "empty string" }.toList)
|
||||
Loading…
Add table
Add a link
Reference in a new issue