Strings Flashcards
1
Q
String
A
String of characters
2
Q
Hello World!
A
puts “Hello World!”
3
Q
Count number of characters
A
.length after a string
input:
puts “hello”.length
output:
5
4
Q
.length
A
Counts first character starting at 1
5
Q
Indexes
A
[] - Is a position in a string that starts count of first character at 0
input:
puts “hello”[0]
output:
h
6
Q
Concatenate
A
To link together
input:
puts “hello “ + “world”
output:
hello world
7
Q
str = “hello”
str.length
A
4
5