Chapter 4 - Strings and Associative Arrays Flashcards

1
Q

Strings are arrays of characters?

A

More accurately, you can READ individual chracters the same way you read specific values in a numerical array, and these individual values are strings of length

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

Are strings mutable?

A

No they are immutable: they can be completely replaced in their entirety, but not changed piecewise.

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

How would I be able to manipulate string characters?

A

You must :

1) Split the string into an array
2) Make individual changes within that array
3) Then join the array to reform a string

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

Referencing individual elements using»>
Convert string to array using&raquo_space;>
Convert array back to string usng»>

A

String.length, string.split, array.join

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

Describe string.split

A

Converts string to array, splitting on the provided parameter.

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

Describe what array.join does

A

By default it will convert an array to a string. Using a provided parameter as a separator…by default it will use ‘,’

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