Category: Collections-Text
Superclass: ArrayedCollection
My instances represent a generic textual (string) data type. I provide accessing and manipulation methods for strings.

Method category index

basic (class)
multibyte encodings (class)
basic (instance)
built ins (instance)
comparing (instance)
converting (instance)
multibyte encodings (instance)
still unclassified (instance)
string processing (instance)
testing functionality (instance)

basic (class)

fromString: aCharacterArray
Make up an instance of the receiver containing the same characters as aCharacterArray, and answer it.

lineDelimiter

Answer a CharacterArray which one can use as a line delimiter. This is meant to be used on subclasses of CharacterArray.

top


multibyte encodings (class)

isUnicode
Answer whether the receiver stores bytes (i.e. an encoded form) or characters (if true is returned).

top


basic (instance)

valueAt: anIndex ifAbsent: aBlock
Answer the ascii value of the anIndex-th character of the receiver, or evaluate aBlock and answer the result if the index is out of range.

top


built ins (instance)

valueAt: index
Answer the ascii value of index-th character variable of the receiver

valueAt: index put: value

Store (Character value: value) in the index-th indexed instance variable of the receiver

top


comparing (instance)

< aCharacterArray
Return true if the receiver is less than aCharacterArray, ignoring case differences.

<= aCharacterArray

Returns true if the receiver is less than or equal to aCharacterArray, ignoring case differences. If is receiver is an initial substring of aCharacterArray, it is considered to be less than aCharacterArray.

= aString

Answer whether the receiver's items match those in aCollection

> aCharacterArray

Return true if the receiver is greater than aCharacterArray, ignoring case differences.

>= aCharacterArray

Returns true if the receiver is greater than or equal to aCharacterArray, ignoring case differences. If is aCharacterArray is an initial substring of the receiver, it is considered to be less than the receiver.

indexOf: aCharacterArray matchCase: aBoolean startingAt: anIndex

Answer an Interval of indices in the receiver which match the aCharacterArray pattern. # in aCharacterArray means 'match any character', * in aCharacterArray means 'match any sequence of characters'. The first item of the returned interval is >= anIndex. If aBoolean is false, the search is case-insensitive, else it is case-sensitive. If no Interval matches the pattern, answer nil.

match: aCharacterArray

Answer whether aCharacterArray matches the pattern contained in the receiver. # in the receiver means 'match any character', * in receiver means 'match any sequence of characters'.

match: aCharacterArray ignoreCase: aBoolean

Answer whether aCharacterArray matches the pattern contained in the receiver. # in the receiver means 'match any character', * in receiver means 'match any sequence of characters'. The case of alphabetic characters is ignored if aBoolean is true.

sameAs: aCharacterArray

Returns true if the receiver is the same CharacterArray as aCharacterArray, ignoring case differences.

top


converting (instance)

asByteArray
Return the receiver, converted to a ByteArray of ASCII values

asClassPoolKey

Return the receiver, ready to be put in a class pool dictionary

asGlobalKey

Return the receiver, ready to be put in the Smalltalk dictionary

asInteger

Parse an Integer number from the receiver until the input character is invalid and answer the result at this point

asLowercase

Returns a copy of self as a lowercase CharacterArray

asNumber

Parse a Number from the receiver until the input character is invalid and answer the result at this point

asPoolKey

Return the receiver, ready to be put in a pool dictionary

asString

But I already am a String! Really!

asSymbol

Returns the symbol corresponding to the CharacterArray

asUnicodeString

Answer a UnicodeString whose character's codes are the receiver's contents This is not implemented unless you load the I18N package.

asUppercase

Returns a copy of self as an uppercase CharacterArray

fileName

But I don't HAVE a file name!

filePos

But I don't HAVE a file position!

isNumeric

Answer whether the receiver denotes a number

trimSeparators

Return a copy of the reciever without any spaces on front or back. The implementation is protected against the `all blanks' case.

top


multibyte encodings (instance)

encoding
Answer the encoding used by the receiver.

isUnicode

Answer whether the receiver stores bytes (i.e. an encoded form) or characters (if true is returned).

numberOfCharacters

Answer the number of Unicode characters in the receiver. This is not implemented unless you load the I18N package.

top


still unclassified (instance)

withUnixShellEscapes
Answer the receiver with special shell characters converted to a backslash sequence.

withWindowsShellEscapes

Answer the receiver with Windows shell characters escaped properly.

top


string processing (instance)

% aCollection
Answer the receiver with special escape sequences replaced by elements of aCollection. %n (1<=n<=9, A<=n<=Z) are replaced by the n-th element of aCollection (A being the 10-th element and so on until the 35th). %(string) sequences are accessed as strings, which makes sense only if aCollection is a Dictionary or LookupTable. In addition, the special pattern %<trueString|falseString>n or %<trueString|falseString>(string) is replaced with one of the two strings depending on the element of aCollection being true or false. The replaced elements are `displayed' (i.e. their displayString is used).

bindWith: s1

Answer the receiver with every %1 replaced by the displayString of s1

bindWith: s1 with: s2

Answer the receiver with every %1 or %2 replaced by s1 or s2, respectively. s1 and s2 are `displayed' (i.e. their displayString is used) upon replacement.

bindWith: s1 with: s2 with: s3

Answer the receiver with every %1, %2 or %3 replaced by s1, s2 or s3, respectively. s1, s2 and s3 are `displayed' (i.e. their displayString is used) upon replacement.

bindWith: s1 with: s2 with: s3 with: s4

Answer the receiver with every %1, %2, %3 or %4 replaced by s1, s2, s3 or s4, respectively. s1, s2, s3 and s4 are `displayed' (i.e. their displayString is used) upon replacement.

bindWithArguments: aCollection

Answer the receiver with special escape sequences replaced by elements of aCollection. %n (1<=n<=9, A<=n<=Z) are replaced by the n-th element of aCollection (A being the 10-th element and so on until the 35th). %(string) sequences are accessed as strings, which makes sense only if aCollection is a Dictionary or LookupTable. In addition, the special pattern %<trueString|falseString>n or %<trueString|falseString>(string) is replaced with one of the two strings depending on the element of aCollection being true or false. The replaced elements are `displayed' (i.e. their displayString is used).

contractTo: smallSize

Either return myself, or a copy shortened to smallSize characters by inserting an ellipsis (three dots: ...)

lines

Answer an Array of Strings each representing one line in the receiver.

linesDo: aBlock

Evaluate aBlock once for every newline delimited line in the receiver, passing the line to the block.

subStrings

Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of white space characters

subStrings: sep

Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every occurrence of one of the characters in sep

substrings

Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of white space characters. This message is preserved for backwards compatibility; the ANSI standard mandates `subStrings', with an uppercase s.

substrings: sep

Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every occurrence of one of the characters in sep. This message is preserved for backwards compatibility; the ANSI standard mandates `subStrings:', with an uppercase s.

withShellEscapes

Answer the receiver with special shell characters converted to a backslash sequence.

top


testing functionality (instance)

isCharacterArray
Answer `true'.

top