Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 1.65 KB

testString.toby

File metadata and controls

86 lines (63 loc) · 1.65 KB
 
Apr 18, 2001
Apr 18, 2001
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function main() returns nothing
string x
array of string[0 to 10] myStrings
number fontHeight = 12
number i
string leftRight
setPenUp()
leftRight = "Left side-=-Middle-=-Right side"
x = "test of stringlength() was successful."
x = rightString(x, stringlength(x) - 8)
myStrings[0] = "String array test."
myStrings[1] = "w00t, old boy, w00t!"
myStrings[2] = joinStrings("this string->", "<-was joined")
myStrings[3] = leftString(leftRight, 9)
myStrings[4] = substring(leftRight, 12, 6)
myStrings[5] = rightString(leftRight, 10)
myStrings[6] = upperCaseString("ThiS IS uPpER casEd.")
myStrings[7] = lowerCaseString("ThiS IS LoWEr casEd.")
myStrings[8] = x
myStrings[9] = "last one"
setTurtleXY(10, fontHeight)
setAngle(0)
x = "passing string in a variable to a function."
drawString(x)
setAngle(90)
goForward(fontHeight)
setAngle(0)
drawString("string literal in a function call.")
setAngle(90)
goForward(fontHeight)
setAngle(0)
if ("equality tester" == "equality tester")
drawString("equality operator working.")
else
drawString("equality operator NOT working!")
endif
setAngle(90)
goForward(fontHeight)
setAngle(0)
if ("abc" > "def")
drawString("greater-than operator working.")
else
drawString("greater-than operator NOT working!")
endif
setAngle(90)
goForward(fontHeight)
setAngle(0)
if ("abc" < "def")
drawString("less-than operator NOT working.")
else
drawString("less-than operator working!")
endif
homeTurtle()
for i = 0 to 10
setPenColor(i + 1)
goForward(fontHeight * 3)
drawString(myStrings[i])
goBackward(fontHeight * 3)
turnRight(36)
endfor
// test rotation.
// test strlen
endfunction