mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 14:48:40 +01:00
18 lines
806 B
Plaintext
18 lines
806 B
Plaintext
System.print("something".replace("some", "no")) // expect: nothing
|
|
System.print("something".replace("thing", "one")) // expect: someone
|
|
System.print("something".replace("ometh", "umm")) // expect: summing
|
|
System.print("something".replace("math", "ton")) // expect: something
|
|
|
|
// Multiple.
|
|
System.print("somethingsomething".replace("some", "no")) // expect: nothingnothing
|
|
System.print("abc abc abc".replace(" ", "")) // expect: abcabcabc
|
|
System.print("abcabcabc".replace("abc", "")) // expect:
|
|
|
|
// Non-ASCII.
|
|
System.print("søméthîng".replace("sømé", "nø")) // expect: nøthîng
|
|
System.print("søméthîng".replace("meth", "ton")) // expect: søméthîng
|
|
|
|
// 8-bit clean.
|
|
System.print("a\0b\0c".replace("\0", "")) // expect: abc
|
|
System.print("a\0b\0c".replace("b", "") == "a\0\0c") // expect: true
|