- Returns a single element String containing the code unit at index _pos_ in the String value resulting from converting this object to a String. If there is no element at that index, the result is the empty String. The result is a String value, not a String object.
+ Returns a single element String containing the code unit at index _pos_ within the String value resulting from converting this object to a String. If there is no element at that index, the result is the empty String. The result is a String value, not a String object.
If `pos` is a value of Number type that is an integer, then the result of `x.charAt(pos)` is equal to the result of `x.substring(pos, pos+1)`.
When the `charAt` method is called with one argument _pos_, the following steps are taken:
@@ -28149,7 +28149,7 @@
String.prototype.charCodeAt ( _pos_ )
- Returns a Number (a nonnegative integer less than 216) that is the code unit value of the string element at index _pos_ in the String resulting from converting this object to a String. If there is no element at that index, the result is *NaN*.
+ Returns a Number (a nonnegative integer less than 216) that is the code unit value of the string element at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *NaN*.
When the `charCodeAt` method is called with one argument _pos_, the following steps are taken:
@@ -28158,7 +28158,7 @@ String.prototype.charCodeAt ( _pos_ )
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ < 0 or _position_ ≥ _size_, return *NaN*.
- 1. Return a value of Number type, whose value is the code unit value of the element at index _position_ in the String _S_.
+ 1. Return a value of Number type, whose value is the code unit value of the element at index _position_ within the String _S_.
The `charCodeAt` function is intentionally generic; it does not require that its *this* value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.
@@ -28169,7 +28169,7 @@ String.prototype.charCodeAt ( _pos_ )
String.prototype.codePointAt ( _pos_ )
- Returns a nonnegative integer Number less than 0x110000 that is the code point value of the UTF-16 encoded code point () starting at the string element at index _pos_ in the String resulting from converting this object to a String. If there is no element at that index, the result is *undefined*. If a valid UTF-16 surrogate pair does not begin at _pos_, the result is the code unit at _pos_.
+ Returns a nonnegative integer Number less than 0x110000 that is the code point value of the UTF-16 encoded code point () starting at the string element at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *undefined*. If a valid UTF-16 surrogate pair does not begin at _pos_, the result is the code unit at _pos_.
When the `codePointAt` method is called with one argument _pos_, the following steps are taken:
@@ -28178,9 +28178,9 @@ String.prototype.codePointAt ( _pos_ )
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ < 0 or _position_ ≥ _size_, return *undefined*.
- 1. Let _first_ be the code unit value of the element at index _position_ in the String _S_.
+ 1. Let _first_ be the code unit value of the element at index _position_ within the String _S_.
1. If _first_ < 0xD800 or _first_ > 0xDBFF or _position_+1 = _size_, return _first_.
- 1. Let _second_ be the code unit value of the element at index _position_+1 in the String _S_.
+ 1. Let _second_ be the code unit value of the element at index _position_+1 within the String _S_.
1. If _second_ < 0xDC00 or _second_ > 0xDFFF, return _first_.
1. Return UTF16Decode(_first_, _second_).
@@ -28263,7 +28263,7 @@ String.prototype.includes ( _searchString_ [ , _position_ ] )
1. Let _len_ be the length of _S_.
1. Let _start_ be min(max(_pos_, 0), _len_).
1. Let _searchLen_ be the length of _searchStr_.
- 1. If there exists any integer _k_ not smaller than _start_ such that _k_ + _searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ of _S_ is the same as the code unit at index _j_ of _searchStr_, return *true*; but if there is no such integer _k_, return *false*.
+ 1. If there exists any integer _k_ not smaller than _start_ such that _k_ + _searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ within _S_ is the same as the code unit at index _j_ within _searchStr_, return *true*; but if there is no such integer _k_, return *false*.
If _searchString_ appears as a substring of the result of converting this object to a String, at one or more indices that are greater than or equal to _position_, return *true*; otherwise, returns *false*. If _position_ is *undefined*, 0 is assumed, so as to search all of the String.
@@ -28291,7 +28291,7 @@ String.prototype.indexOf ( _searchString_ [ , _position_ ] )
1. Let _len_ be the length of _S_.
1. Let _start_ be min(max(_pos_, 0), _len_).
1. Let _searchLen_ be the length of _searchStr_.
- 1. Return the smallest possible integer _k_ not smaller than _start_ such that _k_+_searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ of _S_ is the same as the code unit at index _j_ of _searchStr_; but if there is no such integer _k_, return the value -1.
+ 1. Return the smallest possible integer _k_ not smaller than _start_ such that _k_+_searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ within _S_ is the same as the code unit at index _j_ within _searchStr_; but if there is no such integer _k_, return the value -1.
The `indexOf` function is intentionally generic; it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.
@@ -28314,7 +28314,7 @@ String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )
1. Let _len_ be the length of _S_.
1. Let _start_ be min(max(_pos_, 0), _len_).
1. Let _searchLen_ be the length of _searchStr_.
- 1. Return the largest possible nonnegative integer _k_ not larger than _start_ such that _k_+_searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ of _S_ is the same as the code unit at index _j_ of _searchStr_; but if there is no such integer _k_, return the value -1.
+ 1. Return the largest possible nonnegative integer _k_ not larger than _start_ such that _k_+_searchLen_ is not greater than _len_, and for all nonnegative integers _j_ less than _searchLen_, the code unit at index _k_+_j_ within _S_ is the same as the code unit at index _j_ within _searchStr_; but if there is no such integer _k_, return the value -1.
The `lastIndexOf` function is intentionally generic; it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.
@@ -28710,7 +28710,7 @@ Runtime Semantics: SplitMatch ( _S_, _q_, _R_ )
1. Let _r_ be the number of code units in _R_.
1. Let _s_ be the number of code units in _S_.
1. If _q_+_r_ > _s_, return *false*.
- 1. If there exists an integer _i_ between 0 (inclusive) and _r_ (exclusive) such that the code unit at index _q_+_i_ of _S_ is different from the code unit at index _i_ of _R_, return *false*.
+ 1. If there exists an integer _i_ between 0 (inclusive) and _r_ (exclusive) such that the code unit at index _q_+_i_ within _S_ is different from the code unit at index _i_ within _R_, return *false*.
1. Return _q_+_r_.
@@ -28925,10 +28925,10 @@ %StringIteratorPrototype%.next ( )
1. If _position_ ≥ _len_, then
1. Set _O_.[[IteratedString]] to *undefined*.
1. Return CreateIterResultObject(*undefined*, *true*).
- 1. Let _first_ be the code unit value at index _position_ in _s_.
+ 1. Let _first_ be the code unit value at index _position_ within _s_.
1. If _first_ < 0xD800 or _first_ > 0xDBFF or _position_+1 = _len_, let _resultString_ be the String value consisting of the single code unit _first_.
1. Else,
- 1. Let _second_ be the code unit value at index _position_+1 in the String _S_.
+ 1. Let _second_ be the code unit value at index _position_+1 within the String _S_.
1. If _second_ < 0xDC00 or _second_ > 0xDFFF, let _resultString_ be the String value consisting of the single code unit _first_.
1. Else, let _resultString_ be the string-concatenation of the code unit _first_ and the code unit _second_.
1. Let _resultSize_ be the number of code units in _resultString_.
@@ -30502,9 +30502,9 @@ AdvanceStringIndex ( _S_, _index_, _unicode_ )
1. If _unicode_ is *false*, return _index_+1.
1. Let _length_ be the number of code units in _S_.
1. If _index_+1 ≥ _length_, return _index_+1.
- 1. Let _first_ be the code unit value at index _index_ in _S_.
+ 1. Let _first_ be the code unit value at index _index_ within _S_.
1. If _first_ < 0xD800 or _first_ > 0xDBFF, return _index_+1.
- 1. Let _second_ be the code unit value at index _index_+1 in _S_.
+ 1. Let _second_ be the code unit value at index _index_+1 within _S_.
1. If _second_ < 0xDC00 or _second_ > 0xDFFF, return _index_+1.
1. Return _index_+2.