UnicodeScalarView
Description
Provides a unicode scalar representational view over a unicode component where each element in the view is a 21-bit <UnicodeScalar> which represent all Unicode code points except high/low surrogate code points used for UTF-16.
This view is essentially equivalent to the <Utf32View> except that it works with the <UnicodeScalar> objects instead of basic 32-bit <Integer> objects.
Instance State
Examples
| view |
view := UnicodeScalarView on: 'abc' , String crlf.
self assert: [view next = $a asUnicodeScalar].
self assert: [view next = $b asUnicodeScalar].
self assert: [view next = $c asUnicodeScalar].
self assert: [view next = UnicodeScalar cr].
self assert: [view next = UnicodeScalar lf].
self assert: [view atEnd].
self assert: [view contents = (('abc' , String crlf) asArray collect: [:e | e asUnicodeScalar])]
Class Methods
<details> lineDelimiter
Answer the cached standard line delimiters
Answers:
<Set>
</details>
Instance Methods
<details> lineDelimiter
<pre><code> Answer the line delimiter of the receiver. If undefined, then a default set of Unicode line delimiters will be used.
Standard Line Delimiters: U+000A: LINE FEED (LF) U+000B: LINE TABULATION (VT) U+000C: FORM FEED (FF) U+000D: CARRIAGE RETURN (CR) U+000D U+000A: CR-LF U+0085: NEXT LINE (NEL) U+2028: LINE SEPARATOR U+2029: PARAGRAPH SEPARATOR Answers: <SequenceableCollection> of <UnicodeScalar> or nil for default </code></pre> </details>
<details> lineDelimiter:
Set the line delimiter of the receiver.
Compat provided for String and Character.
Arguments:
anObject - <UnicodeScalar> scalar delim
<Grapheme> grapheme delim
<UnicodeString> graphemes
<Array> of <implementors of #asUnicodeScalar>
Compat: <String | Character>
Answers:
<UnicodeView> self
</details>
<details> linesDo:
Execute aBlock with each line in this string.
Line delimiters are not included in what is passed to @aBlock
Arguments:
aBlock - <Block> 1-arg block with each line
</details>
<details> nextLine
Answer the elements between the current position and the next lineDelimiter.
Answers:
<Array>
</details>
<details> supportsLineDelimiters
Subclasses that support line delimiters should override
and answer true. This will allow for apis like nextLine
Answers:
<Boolean>
</details>
Last modified date: 01/18/2023