eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Unicode16String':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Unicode16String


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--CharacterArray
                  |
                  +--TwoByteString
                     |
                     +--Unicode16String

Package:
stx:libbasic
Category:
Collections-Text
Version:
rev: 1.28 date: 2019/05/28 12:46:30
user: stefan
file: Unicode16String.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


Represents 16-bit (2-byte) Unicode strings.


Class protocol:

initialization
o  initialize
initialize the class - private

usage example(s):

     Unicode16String initialize

reading
o  readFrom: aStreamOrString onError: exceptionBlock
read & return the next String from the (character-)stream aStream;
skipping all whitespace first; return the value of exceptionBlock,
if no string can be read. The sequence of characters as read from the
stream must be one as stored via storeOn: or storeString.

usage example(s):

        self readFrom:'abcäöü' storeString


Instance protocol:

conversion
o  asUnicode16String
as the receiver already is a unicode-16 string, return it

o  asUnicodeString
as the receiver already is a unicode string, return it

o  utf16Encoded
have to encode only if there are characters that are outside the UTF-16 range

usage example(s):

        ((Unicode16String new:1) at:1 put:16rD800; yourself) utf16Encoded
        ((Unicode16String new:1) at:1 put:16r2A00; yourself) utf16Encoded

printing & storing
o  displayOn: aGCOrStream
display myself as on aStream.
You must use an ISO10646 unicode font to display this string

o  printOn: aStream
print the receiver on aStream.
Let aStream decide how to represent this, whether utf8, ucs16, ...

o  storeOn: aStream
put the storeString of myself on aStream

usage example(s):

        String streamContents:[:s|
            'hello' asUnicodeString storeOn:s
        ].

        String streamContents:[:s|
            'hello -öäüß' asUnicodeString storeOn:s
        ].

o  storeString
return a String for storing myself

usage example(s):

        'hello' asUnicodeString storeString
        'hello -öäüß' storeString
        'hello -öäüß' asUnicodeString storeString

o  unicodeStoreOn: aStream
put the storeString of myself on aStream

o  unicodeStoreString
return a UnicodeString for storing myself.
This method is a kind of kludge.
Use it when you want to write a storeString to an encoded Stream

testing
o  isUnicode16String

o  isUnicodeString
true if this is a 2- or 4-byte unicode string
(i.e. not a single byte string).
Notice, that the name is misleading:
all strings are use unicode encoding



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 05:44:37 GMT