September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#import system.
|
||||
import extensions.
|
||||
|
||||
#symbol program =
|
||||
program =
|
||||
[
|
||||
#var s := "Mary had a @@x lamb." replace &literal:"@@x" &literal:"little".
|
||||
console writeLine:s.
|
||||
var s := "little".
|
||||
console printLineFormatted("Mary had a {0} lamb.",s); readChar.
|
||||
].
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
Public Sub Main()
|
||||
|
||||
Print Subst("Mary had a &1 lamb", "little")
|
||||
|
||||
End
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#listix#
|
||||
|
||||
<how> //little
|
||||
<what> //has a @<how> lamb
|
||||
|
||||
<main> //Mary @<what>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// version 1.0.6
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val s = "little"
|
||||
// String interpolation using a simple variable
|
||||
println("Mary had a $s lamb")
|
||||
|
||||
// String interpolation using an expression (need to wrap it in braces)
|
||||
println("Mary had a ${s.toUpperCase()} lamb")
|
||||
|
||||
// However if a simple variable is immediately followed by a letter, digit or underscore
|
||||
// it must be treated as an expression
|
||||
println("Mary had a ${s}r lamb") // not $sr
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import strutils
|
||||
|
||||
var str = "little"
|
||||
echo "Mary had a $# lamb" % [str]
|
||||
# doesn't need an array for one substitution, but use an array for multiple substitutions
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
val extra = "little"
|
||||
val result = s"Mary had a $extra lamb."
|
||||
|
|
@ -1 +0,0 @@
|
|||
Mary had a little lamb.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
val original = "Mary had a %s lamb."
|
||||
val extra = "little"
|
||||
original format extra
|
||||
|
|
@ -1 +0,0 @@
|
|||
Mary had a little lamb.
|
||||
|
|
@ -0,0 +1 @@
|
|||
"Mary had a X lamb.".replace("X","big")
|
||||
Loading…
Add table
Add a link
Reference in a new issue