eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'StringCollection':

Home

everywhere
www.exept.de
for:
[back]

Class: StringCollection


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--OrderedCollection
            |
            +--StringCollection
               |
               +--FileText

Package:
stx:libbasic
Category:
Collections-Text
Version:
rev: 1.40 date: 2009/05/14 10:06:39
user: cg
file: StringCollection.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


StringCollection is an variable sized array of lines which are strings.
WARNING:
    This class is temporary (a historic leftover) - it may change or
    even vanish in the future. Use OrderedCollections or other standard
    classes to represent collections of strings.

StringCollection used to be called Text, but this is a very bad name
 - there is something totally different also named Text in ST-80 ...


Class protocol:

instance creation
o  from: aString

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  fromArray: anArray
return a new text object with lines taken from the argument, an array
of strings

o  fromString: aString
return a new text object with lines taken from the argument, aString

o  new: size
return a new string collection with size empty lines

o  withSize: size
return a new string collection with size empty lines


Instance protocol:

converting
o  asString
return myself as a string with embedded cr's

o  asStringCollection
return the receiver as a stringCollection - thats easy

o  asStringWithoutEmphasis
return myself as a string with embedded cr's, but drop any emphasis

o  asStringWithoutFinalCR
return myself as a string with embedded cr's
but do not add a final CR

o  encodeFrom: oldEncoding into: newEncoding

o  from: aString

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  fromString: aString
setup my contents from the argument, aString

copying
o  copyEmpty: size
we have to redefine this, since 'self class new:size' does allocate size nil lines.
In order to get collect working, we have to undo this allocation

o  withoutLeadingBlankLines
return a copy of the receiver with leading blank lines removed.
If there are no leading blank lines, the original receiver is returned.
If all lines are blank, an empty string collection is returned.

o  withoutTrailingBlankLines
return a copy of the receiver with trailing blank lines removed.
If there are no trailing blank lines, the original receiver is returned.
If all lines are blank, an empty string collection is returned.

printing & storing
o  printOn: aStream
print myself on aStream with embedded cr's

o  printString
return the receivers printString

queries
o  encoding

searching
o  indexOfLineStartingWith: aString
return the index of the first line starting with the argument, aString

special converting
o  withTabs
return a new stringCollection consisting of the receivers lines,
where leading spaces are replaced by tabulator characters (assuming 8-col tabs).
Notice: lines which do not contain leading spaces, are copied by reference to the
new stringCollection (i.e. shared);
otherwise new strings is created.
Limitation: only the very first spaces are replaced

o  withTabsExpanded
return a new stringCollection consisting of the receivers lines,
where tabs are replaced by space characters (assuming 8-col tabs).
Notice: lines which do not contain any tab, are copied by reference to the
new stringCollection (i.e. shared);
otherwise new strings is created.

testing
o  isStringCollection
return true, if the receiver is some kind of stringCollection;
true is returned here - the method is redefined from Object.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 21:15:19 GMT