Back: Character-testing functionality Up: Base classes Forward: CharacterArray class-basic   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.28 CharacterArray

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

1.28.1 CharacterArray class: basic  (class)
1.28.2 CharacterArray class: multibyte encodings  (class)
1.28.3 CharacterArray: built ins  (instance)
1.28.4 CharacterArray: comparing  (instance)
1.28.5 CharacterArray: converting  (instance)
1.28.6 CharacterArray: multibyte encodings  (instance)
1.28.7 CharacterArray: string processing  (instance)
1.28.8 CharacterArray: testing functionality  (instance)


1.28.1 CharacterArray class: basic

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.


1.28.2 CharacterArray class: multibyte encodings

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


1.28.3 CharacterArray: built ins

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


1.28.4 CharacterArray: comparing

< 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.

endsWith: aCharacterArray
Returns true if the receiver ends with the same characters as aCharacterArray.

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 in- terval is >= anIndex. If aBoolean is false, the search is case-insen- sitive, 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.

startsWith: aCharacterArray
Returns true if the receiver starts with the same characters as aCharacterArray.


1.28.5 CharacterArray: converting

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.


1.28.6 CharacterArray: multibyte encodings

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.


1.28.7 CharacterArray: string processing

% anArray
Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray. The replaced elements are `displayed' (i.e. their displayString is used). In addition, the special pattern %<trueString|falseString>n is replaced with one of the two strings depending on the n-th element of anArray being true or false.

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: anArray
Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray. The replaced elements are `displayed' (i.e. their displayString is used). In addition, the special pattern %<trueString|falseString>n is replaced with one of the two strings depending on the n-th element of anArray being true or false.

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: aCharacter
Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of characters matching aCharacter

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: aCharacter
Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of characters matching aCharacter. This message is preserved for backwards compatibility; the ANSI standard mandates `subStrings:', with an uppercase s.


1.28.8 CharacterArray: testing functionality

isCharacterArray
Answer `true'.



Back: CharacterArray-string processing Up: CharacterArray Forward: CInt   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on May, 22 2008 using texi2html