[Newbies] Fwd: WideString

Ramiro Diaz Trepat ramirodt at gmail.com
Tue Apr 10 12:59:10 UTC 2007


Hello,
    I was parsing a small text file, character by character, onto a
collection that later on I wanted to convert to a String.
    I found that to convert a SequencableCollection of characters to a
String, I only can store the characters as Integers, then convert the
collection using #asByteArray and then call #asString.  I could not
find any other way to convert a collection filled with characters to a
String.
   The file I was parsing, contains utf8 characters, hence the
asByteArray asString sequence did not work for me.  To get it working,
I had to use #asIntegerArray and add the method #asWideString to the
class IntegerArray, with the following implementation:

IntegerArray>>asWideString
        ^ (WideString new: self size) replaceFrom: 1 to: self size with: self

Which is analogous to the ByteArray implementation of #asString.

   My questions are the following:

   Since ByteArray has the conversion method #asString, do you guys
think this method should also be added to IntegerArray to handle
WideString instances ?
   What is the proper way to submit changes to basic classes like IntegerArray ?


More information about the Beginners mailing list