String API Flashcards

1
Q

string.match(regexp)

A

Used to retrieve the matches when matching a string against a regular expression.

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

string.indexOf(searchValue[, fromIndex])

A

Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex, returns -1 if the value is not found.

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

string.localeCompare(compareString)

A

Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.

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

string.charAt(index)

A

Returns the specified character from a string.

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

Removes whitespace from the right end of the string.

A

string.trimRight()

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

Removes whitespace from the left end of the string.

A

string.trimLeft()

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

Returns the specified character from a string.

A

string.charAt(index)

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

Executes the search for a match between a regular expression and this String object.

A

string.search(regexp)

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

Used to retrieve the matches when matching a string against a regular expression.

A

string.match(regexp)

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

Returns the characters in a string beginning at the specified location through the specified number of characters.

A

string.substr(start[, length])

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

Combines the text of two or more strings and returns a new string.

A

string.concat(string2, string3[, …, stringN])

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

Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex, returns -1 if the value is not found.

A

string.indexOf(searchValue[, fromIndex])

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

string.lastIndexOf(searchValue[, fromIndex])

A

Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex.

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

string.substr(start[, length])

A

Returns the characters in a string beginning at the specified location through the specified number of characters.

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

string.search(regexp)

A

Executes the search for a match between a regular expression and this String object.

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

Extracts a section of a string and returns a new string.

A

string.slice(beginslice[, endSlice])

  • if not specified, endSlice is the end of the string
  • beginSlice and endSlice can be negative numbers
17
Q

Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex.

A

string.lastIndexOf(searchValue[, fromIndex])

18
Q

string.slice(beginslice[, endSlice])

A

Extracts a section of a string and returns a new string.

  • beginSlice and endSlice can be negative
  • if endSlice ommited, it extracts until the end of the string
19
Q

string.trim()

A

Removes whitespace from both ends of the string.

20
Q

str.replace(regexp|substr, newSubStr|function[, Non-standard flags]);

A

Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match.

21
Q

Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match.

A

str.replace(regexp|substr, newSubStr|function[, Non-standard flags]);

22
Q

string.concat(string2, string3[, …, stringN])

A

Combines the text of two or more strings and returns a new string.

23
Q

Splits a String object into an array of strings by separating the string into substrings.

A

string.split([separator][, limit])

24
Q

string.trimLeft()

A

Removes whitespace from the left end of the string.

25
Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
string.localeCompare(compareString)
26
string.split([separator][, limit])
Splits a String object into an array of strings by separating the string into substrings.
27
string.trimRight()
Removes whitespace from the right end of the string.
28
Removes whitespace from both ends of the string.
string.trim()