Strings Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

String

A

String of characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Hello World!

A

puts “Hello World!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Count number of characters

A

.length after a string
input:
puts “hello”.length
output:
5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.length

A

Counts first character starting at 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Indexes

A

[] - Is a position in a string that starts count of first character at 0
input:
puts “hello”[0]
output:
h

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Concatenate

A

To link together
input:
puts “hello “ + “world”
output:
hello world

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

str = “hello”
str.length

A

4
5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly