GraphemeView
Description
Provides a grapheme representational and bidirectional view over a unicode component where each element in the view is an extended grapheme cluster (which approximate human-readable characters).
A <Grapheme> is also the default representation of a <UnicodeString>. When APIs such as #at:, #size, #copyFrom:to: are used, its relative to graphemes.
#next/#previous - Answers a <Grapheme>.
#contents - Answers a <UnicodeString>
Instance State
lineDelimiter: <Object> grapheme or sequenceable collection of graphemes
Examples
| view |
view := GraphemeView on: 'abc' , String crlf.
self assert: [view next = $a asGrapheme].
self assert: [view next = $b asGrapheme].
self assert: [view next = $c asGrapheme].
self assert: [view next = Grapheme crlf].
self assert: [view atEnd].
self assert: [view contents = ('abc' , String crlf) asUnicodeString]
Class Methods
None
Instance Methods
lineDelimiter
   Answer the line delimiter of the receiver.
   If undefined, then a default set of Unicode line delimiters will be used.
   This is the set of graphemes defined in Grapheme>>isNewline
     
   Answers:
    <SequenceableCollection> of <Grapheme> or nil for default
lineDelimiter:
   Set the line delimiter of the receiver.
   Compat provided for String and Character.
   
   Notes:
    Any <Cr><Lf> will be replaced with Grapheme crlf since
    this is one grapheme in Unicode.
   
   Arguments:
    anObject - <Grapheme> grapheme delim
              <UnicodeScalar> scalar delim
              <UnicodeString> graphemes
              <Array> of <implementors of #asGrapheme>
              Compat: <String | Character>
   Answers:
    <UnicodeView> self
linesDo:
   Execute aBlock with each line in this string.
   The line delimiters used can be found in Grapheme>>isNewline.
   Line delimiters are not included in what is passed to @aBlock
   
   Arguments:  
    aBlock - <Block> 1-arg block with each line
nextLine
   Answer the elements between the current position and the next lineDelimiter.
   
   Answers:
    <UnicodeString>
supportsLineDelimiters
   Subclasses that support line delimiters should override
   and answer true.  This will allow for apis like nextLine
   
   Answers:
    <Boolean>
Last modified date: 01/18/2023