|
Class: Unicode16String
Object
|
+--Collection
|
+--SequenceableCollection
|
+--ArrayedCollection
|
+--UninterpretedBytes
|
+--CharacterArray
|
+--TwoByteString
|
+--Unicode16String
- Package:
- stx:libbasic
- Category:
- Collections-Text
- Version:
- rev:
1.39
date: 2024/02/18 08:16:32
- user: cg
- file: Unicode16String.st directory: libbasic
- module: stx stc-classLibrary: libbasic
Represents 16-bit (2-byte) Unicode strings.
copyrightCOPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
initialization
-
initialize
-
initialize the class - private
Usage example(s):
Unicode16String initialize
|
reading
-
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
|
conversion
-
asUnicode16String
-
as the receiver already is a unicode-16 string, return it
-
asUnicodeString
-
as the receiver already is a unicode string, return it
encoding
-
utf16Encoded
-
answer a Unicode16String, where characters out of the UTF-16 range are encoded
as two 16-bit values.
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
|
-
utf8Encoded
-
tuned version of the inherited encoder;
this is so heavily used, that it is worth a primitive
printing & storing
-
displayOn: aGCOrStream
-
display myself as on aStream.
You must use an ISO10646 unicode font to display this string
-
printOn: aStream
-
print the receiver on aStream.
Let aStream decide how to represent this, whether UTF-8, UTF-16, ...
Usage example(s):
'Hällo здраво' asUnicode16String printOn:'' writeStream inspect.
|
-
storeOn: aStream
-
put the storeString of myself on aStream.
Convert it to something that can be written to a plain ASCII file.
Use #unicodeStoreOn: if you want to use the result internally,
especially when writing to an EncodedStream.
Usage example(s):
String streamContents:[:s|
'hello' asUnicode16String storeOn:s
].
String streamContents:[:s|
'hello -öäüßщ' asUnicode16String storeOn:s
].
|
-
storeString
-
return a String for storing myself-
Convert it to something that can be written to a plain ASCII file.
Use #unicodeStoreString if you want to use the result internally,
especially when writing to an EncodedStream.
Usage example(s):
'hello' asUnicodeString storeString
'hello -öäüß' storeString
'hello öäüßщ' storeString
'hello öäüßщ' unicodeStoreString
|
testing
-
isLiteral
-
return true, if the receiver can be used as a literal constant in ST syntax
(i.e. can be used in constant arrays)
-
isUnicode16String
-
-
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 use unicode encoding
|