The Crow Programming Language

Strings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
s = '  Hello, Crow  '
log[trim[s]]
log[upper['crow']]
log[lower['CROW']]
log[replace['a-b-c', '-', '+']]
log[starts['crowfile', 'crow']]
log[ends['main.co', '.co']]
log[repeat['ab', 3]]
log[split['x,y,z', ',']]
log[join[['x', 'y', 'z'], '/']]
log[reverse['abc']]
w = 'hello'
log[len[w]]
log[w[0]]
log[w[-1]]

expected output — from the book, verified by crow test --book

Hello, Crow
CROW
crow
a+b+c
true
true
ababab
['x', 'y', 'z']
x/y/z
cba
5
h
o

Reference: spec section 11 (Strings) and section 1 (String Interpolation).