|
|
6.133 String
- Defined in namespace Smalltalk
- Category: Language-Data types
- My instances represent ASCII string data types. Being a very common
case, they are particularly optimized.
6.133.1 String class: basic
- , aString
- Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection
6.133.2 String class: instance creation
- fromCData: aCObject size: anInteger
- Answer a String containing anInteger bytes starting at the location pointed to by aCObject
6.133.3 String: built ins
- asCData: aCType
- Convert the receiver to a CObject with the given type
- at: index
- Answer the index-th character of the receiver.
- at: index put: value
- Change the index-th character of the receiver.
- basicAt: index
- Answer the index-th character of the receiver. This method must not be overridden; override at: instead. String overrides it so that it looks like it contains character objects even though it contains bytes
- basicAt: index put: value
- Change the index-th character of the receiver. This method must not be overridden; override at: instead. String overrides it so that it looks like it contains character objects even though it contains bytes
- hash
- Answer an hash value for the receiver
- primReplaceFrom: start to: stop with: replacementString
- startingAt: replaceStart
Private - Replace the characters from start to stop with new characters contained in replacementString (which, actually, can be any variable byte class, starting at the replaceStart location of replacementString
- replaceFrom: start to: stop with: aString startingAt: replaceStart
- Replace the characters from start to stop with new characters whose ASCII codes are contained in aString, starting at the replaceStart location of aString
- replaceFrom: start to: stop withByteArray: byteArray startingAt: replaceStart
- Replace the characters from start to stop with new characters whose ASCII codes are contained in byteArray, starting at the replaceStart location of byteArray
- size
- Answer the size of the receiver
6.133.4 String: converting
- asByteArray
- Return the receiver, converted to a ByteArray of ASCII values
- asString
- But I already am a String! Really!
- asSymbol
- Returns the symbol corresponding to the receiver
6.133.5 String: storing
- storeOn: aStream
- Print Smalltalk code compiling to the receiver on aStream
6.133.6 String: testing functionality
- isString
- Answer `true'.
6.133.7 String: useful functionality
- linesDo: aBlock
- Send 'aBlock' a substring of the receiver for each newline delimited line in the receiver
|