|
|
Class: StringCollection
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
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 ...
instance creation
-
from: aString
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
fromArray: anArray
-
return a new text object with lines taken from the argument, an array
of strings
-
fromString: aString
-
return a new text object with lines taken from the argument, aString
-
new: size
-
return a new string collection with size empty lines
-
withSize: size
-
return a new string collection with size empty lines
converting
-
asString
-
return myself as a string with embedded cr's
-
asStringCollection
-
return the receiver as a stringCollection - thats easy
-
asStringWithoutEmphasis
-
return myself as a string with embedded cr's, but drop any emphasis
-
asStringWithoutFinalCR
-
return myself as a string with embedded cr's
but do not add a final CR
-
encodeFrom: oldEncoding into: newEncoding
-
-
from: aString
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
fromString: aString
-
setup my contents from the argument, aString
copying
-
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
-
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.
-
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
-
printOn: aStream
-
print myself on aStream with embedded cr's
-
printString
-
return the receivers printString
queries
-
encoding
-
searching
-
indexOfLineStartingWith: aString
-
return the index of the first line starting with the argument, aString
special converting
-
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
-
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
-
isStringCollection
-
return true, if the receiver is some kind of stringCollection;
true is returned here - the method is redefined from Object.
|