Skip to content

Commit

Permalink
Editorial: "at index _p_ (within|in|of) _str_": pick "within"
Browse files Browse the repository at this point in the history
The three choices are used almost equally, but "within" wins,
because it's the word used in the definition of the String type.
  • Loading branch information
jmdyck committed Aug 19, 2017
1 parent c167109 commit 3484815
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -28128,7 +28128,7 @@ <h1>Properties of the String Prototype Object</h1>
<emu-clause id="sec-string.prototype.charat">
<h1>String.prototype.charAt ( _pos_ )</h1>
<emu-note>
<p>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.</p>
<p>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.</p>
<p>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)`.</p>
</emu-note>
<p>When the `charAt` method is called with one argument _pos_, the following steps are taken:</p>
Expand All @@ -28149,7 +28149,7 @@ <h1>String.prototype.charAt ( _pos_ )</h1>
<emu-clause id="sec-string.prototype.charcodeat">
<h1>String.prototype.charCodeAt ( _pos_ )</h1>
<emu-note>
<p>Returns a Number (a nonnegative integer less than 2<sup>16</sup>) 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*.</p>
<p>Returns a Number (a nonnegative integer less than 2<sup>16</sup>) 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*.</p>
</emu-note>
<p>When the `charCodeAt` method is called with one argument _pos_, the following steps are taken:</p>
<emu-alg>
Expand All @@ -28158,7 +28158,7 @@ <h1>String.prototype.charCodeAt ( _pos_ )</h1>
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ &lt; 0 or _position_ &ge; _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_.
</emu-alg>
<emu-note>
<p>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.</p>
Expand All @@ -28169,7 +28169,7 @@ <h1>String.prototype.charCodeAt ( _pos_ )</h1>
<emu-clause id="sec-string.prototype.codepointat">
<h1>String.prototype.codePointAt ( _pos_ )</h1>
<emu-note>
<p>Returns a nonnegative integer Number less than 0x110000 that is the code point value of the UTF-16 encoded code point (<emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>) 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_.</p>
<p>Returns a nonnegative integer Number less than 0x110000 that is the code point value of the UTF-16 encoded code point (<emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>) 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_.</p>
</emu-note>
<p>When the `codePointAt` method is called with one argument _pos_, the following steps are taken:</p>
<emu-alg>
Expand All @@ -28178,9 +28178,9 @@ <h1>String.prototype.codePointAt ( _pos_ )</h1>
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ &lt; 0 or _position_ &ge; _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_ &lt; 0xD800 or _first_ &gt; 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_ &lt; 0xDC00 or _second_ &gt; 0xDFFF, return _first_.
1. Return UTF16Decode(_first_, _second_).
</emu-alg>
Expand Down Expand Up @@ -28263,7 +28263,7 @@ <h1>String.prototype.includes ( _searchString_ [ , _position_ ] )</h1>
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*.
</emu-alg>
<emu-note>
<p>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.</p>
Expand Down Expand Up @@ -28291,7 +28291,7 @@ <h1>String.prototype.indexOf ( _searchString_ [ , _position_ ] )</h1>
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.
</emu-alg>
<emu-note>
<p>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.</p>
Expand All @@ -28314,7 +28314,7 @@ <h1>String.prototype.lastIndexOf ( _searchString_ [ , _position_ ] )</h1>
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.
</emu-alg>
<emu-note>
<p>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.</p>
Expand Down Expand Up @@ -28710,7 +28710,7 @@ <h1>Runtime Semantics: SplitMatch ( _S_, _q_, _R_ )</h1>
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_ &gt; _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_.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -28925,10 +28925,10 @@ <h1>%StringIteratorPrototype%.next ( )</h1>
1. If _position_ &ge; _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_ &lt; 0xD800 or _first_ &gt; 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_ &lt; 0xDC00 or _second_ &gt; 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_.
Expand Down Expand Up @@ -30502,9 +30502,9 @@ <h1>AdvanceStringIndex ( _S_, _index_, _unicode_ )</h1>
1. If _unicode_ is *false*, return _index_+1.
1. Let _length_ be the number of code units in _S_.
1. If _index_+1 &ge; _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_ &lt; 0xD800 or _first_ &gt; 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_ &lt; 0xDC00 or _second_ &gt; 0xDFFF, return _index_+1.
1. Return _index_+2.
</emu-alg>
Expand Down

0 comments on commit 3484815

Please sign in to comment.