Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/Binary-strings/Nim/binary-strings.nim
Normal file
23
Task/Binary-strings/Nim/binary-strings.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
var # creation
|
||||
x = "this is a string"
|
||||
y = "this is another string"
|
||||
z = "this is a string"
|
||||
|
||||
if x == z: echo "x is z" # comparison
|
||||
|
||||
z = "now this is another string too" # assignment
|
||||
|
||||
y = z # copying
|
||||
|
||||
if x.len == 0: echo "empty" # check if empty
|
||||
|
||||
x.add('!') # append a byte
|
||||
|
||||
echo x[5..8] # substring
|
||||
echo x[8 .. -1] # substring
|
||||
|
||||
z = x & y # join strings
|
||||
|
||||
import strutils
|
||||
|
||||
echo z.replace('t', 'T') # replace occurences of t with T
|
||||
Loading…
Add table
Add a link
Reference in a new issue