Simple string interpolation.
This allows "%(...)" inside a string literal to interpolate the stringified result of an expression. It doesn't support custom interpolators or format strings, but we can consider extending that later.
This commit is contained in:
@@ -10,7 +10,7 @@ for (i in 1..1000000) {
|
||||
|
||||
if ("" == "abc") count = count + 1
|
||||
if ("abc" == "abcd") count = count + 1
|
||||
if ("changed one character" == "changed %ne character") count = count + 1
|
||||
if ("changed one character" == "changed !ne character") count = count + 1
|
||||
if ("123" == 123) count = count + 1
|
||||
if ("a slightly longer string" ==
|
||||
"a slightly longer string!") count = count + 1
|
||||
@@ -21,4 +21,4 @@ for (i in 1..1000000) {
|
||||
}
|
||||
|
||||
System.print(count)
|
||||
System.print("elapsed: " + (System.clock - start).toString)
|
||||
System.print("elapsed: %(System.clock - start)")
|
||||
|
||||
Reference in New Issue
Block a user