2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,6 +1,13 @@
{{basic data operation}} [[Category:Simple]]
{{basic data operation}}
[[Category:Simple]]
Most languages provide a way to concatenate two string values, but some languages also provide a convenient way to append in-place to an existing string variable without referring to the variable twice.
For this task, create a string variable equal to any text value.
;Task:
Create a string variable equal to any text value.
Append the string variable with another string literal in the most idiomatic way, without double reference if your language supports it.
Show the contents of the variable after the append operation.
<br><br>

View file

@ -0,0 +1,23 @@
identification division.
program-id. string-append.
data division.
working-storage section.
01 some-string.
05 elements pic x occurs 0 to 80 times depending on limiter.
01 limiter usage index value 7.
01 current usage index.
procedure division.
append-main.
move "Hello, " to some-string
*> extend the limit and move using reference modification
set current to length of some-string
set limiter up by 5
move "world" to some-string(current + 1:)
display some-string
goback.
end program string-append.

View file

@ -0,0 +1,5 @@
a = "Hello, "
b = "World!"
c = a + b
console.log c

View file

@ -0,0 +1 @@
console.log "Hello, ".concat "World!"

View file

@ -0,0 +1,11 @@
fun main(args: Array<String>) {
var s = "a"
s += "b"
s += "c"
println(s)
println("a" + "b" + "c")
val a = "a"
val b = "b"
val c = "c"
println("$a$b$c")
}

View file

@ -0,0 +1,12 @@
function string:show ()
print(self)
end
function string:append (s)
self = self .. s
end
x = "Hi "
x:show()
x:append("there!")
x:show()

View file

@ -0,0 +1,3 @@
x = "Hi "
x = x .. "there!"
print(x)

View file

@ -0,0 +1,3 @@
a := "Hello";
b := cat(a, " World");
c := `||`(a, " World");

View file

@ -0,0 +1,4 @@
s = "Hello"
s = s ", World!"
OUTPUT = s
END