Collections-Strings

ByteString
This class represents the array of 8 bit wide characters.
applyLanguageInfomation:
asByteArray
Convert to a ByteArray with the ascii values of the string.
asOctetString
Convert the receiver into an octet string
at:
Primitive. Answer the Character stored in the field of the receiver
indexed by the argument. Fail if the index argument is not an Integer or
is out of bounds. Essential. See Object documentation whatIsAPrimitive.
at:put:
Primitive. Store the Character in the field of the receiver indicated by
the index. Fail if the index is not an Integer or is out of bounds, or if
the argument is not a Character. Essential. See Object documentation
whatIsAPrimitive.
beginsWith:
Answer whether the receiver begins with the given prefix string.
The comparison is case-sensitive.
byteAt:
byteAt:put:
byteSize
compare:with:collated:
convertFromCompoundText
convertFromSystemString
findFirstInString:inSet:startingAt:
findSubstring:in:startingAt:matchTable:
Answer the index in the string body at which the substring key first occurs, at or beyond start. The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches. If no match is found, zero will be returned.
findSubstringViaPrimitive:in:startingAt:matchTable:
Answer the index in the string body at which the substring key first occurs, at or beyond start. The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches. If no match is found, zero will be returned.
The algorithm below is not optimum -- it is intended to be translated to C which will go so fast that it wont matter.
hasWideCharacterFrom:to:
Only WideStrings contain these characters
indexOfAscii:inString:startingAt:
isByteString
Answer whether the receiver is a ByteString
isOctetString
Answer whether the receiver can be represented as a byte string.
This is different from asking whether the receiver *is* a ByteString
(i.e., #isByteString)
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
stringHash:initialHash:
translate:from:to:table:
ByteSymbol
This class represents the symbols containing 8bit characters.
asByteArray
Convert to a ByteArray with the ascii values of the string.
asOctetString
Convert the receiver into an octet string
at:
Primitive. Answer the Character stored in the field of the receiver
indexed by the argument. Fail if the index argument is not an Integer or
is out of bounds. Essential. See Object documentation whatIsAPrimitive.
beginsWith:
Answer whether the receiver begins with the given prefix string.
The comparison is case-sensitive.
byteAt:
byteAt:put:
You cannot modify the receiver.
byteSize
findFirstInString:inSet:startingAt:
findSubstring:in:startingAt:matchTable:
Answer the index in the string body at which the substring key first occurs, at or beyond start. The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches. If no match is found, zero will be returned.
hasWideCharacterFrom:to:
Always false because I only contains byte characters
indexOfAscii:inString:startingAt:
isByteString
Answer whether the receiver is a ByteString
isOctetString
Answer whether the receiver can be represented as a byte string.
This is different from asking whether the receiver *is* a ByteString
(i.e., #isByteString)
pvtAt:put:
Primitive. Store the Character in the field of the receiver indicated by
the index. Fail if the index is not an Integer or is out of bounds, or if
the argument is not a Character. Essential. See Object documentation
whatIsAPrimitive.
species
Answer the preferred class for reconstructing the receiver.
string:
stringHash:initialHash:
translate:from:to:table:
Character
I represent a character by storing its associated Unicode. The first 256 characters are created uniquely, so that all instances of latin1 characters ($R, for example) are identical.
The code point is based on Unicode. Since Unicode is 21-bit wide character set, we have several bits available for other information. As the Unicode Standard states, a Unicode code point doesn't carry the language information. This is going to be a problem with the languages so called CJK (Chinese, Japanese, Korean. Or often CJKV including Vietnamese). Since the characters of those languages are unified and given the same code point, it is impossible to display a bare Unicode code point in an inspector or such tools. To utilize the extra available bits, we use them for identifying the languages. Since the old implementation uses the bits to identify the character encoding, the bits are sometimes called "encoding tag" or neutrally "leading char", but the bits rigidly denotes the concept of languages.
The other languages can have the language tag if you like. This will help to break the large default font (font set) into separately loadable chunk of fonts. However, it is open to the each native speakers and writers to decide how to define the character equality, since the same Unicode code point may have different language tag thus simple #= comparison may return false.
I represent a character by storing its associated ASCII code (extended to 256 codes). My instances are created uniquely, so that all instances of a character ($R, for example) are identical.
<
Answer true if the receiver's value < aCharacter's value.
=
Primitive. Answer true if the receiver and the argument are the same
object (have the same object pointer) and false otherwise. Optional. See
Object documentation whatIsAPrimitive.
>
Answer true if the receiver's value > aCharacter's value.
allByteCharacters
allCharacters
alphabet
arrowDown
arrowLeft
arrowRight
arrowUp
asCharacter
Answer the receiver itself.
asIRCLowercase
convert to lowercase, using IRC's rules
asInteger
Answer the value of the receiver.
asLowercase
If the receiver is uppercase, answer its matching lowercase Character.
asString
Answer a string that represents the receiver.
asSymbol
Answer a Symbol consisting of the receiver as the only element.
asText
asUnicode
asUnicodeChar
Answer a copy of the receiver with Unicode as the leadingChar
asUppercase
If the receiver is lowercase, answer its matching uppercase Character.
asciiValue
Answer the value of the receiver that represents its ascii encoding.
backspace
basicSqueakToIso
canBeGlobalVarInitial
canBeNonGlobalVarInitial
charCode
characterTable
clone
Answer with the receiver, because Characters are unique.
codePoint
codePoint:
comeFullyUpOnReload:
Use existing an Character. Don't use the new copy.
constantNameFor:
constantNames
copy
Answer with the receiver because Characters are unique.
cr
deepCopy
Answer with the receiver because Characters are unique.
delete
digitValue
Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0
otherwise. This is used to parse literal numbers of radix 2-36.
digitValue:
end
enter
escape
escapeEntities
euro
hash
Hash is reimplemented because = is implemented.
hex
home
initialize
Subclasses should redefine this method to perform initializations on instance creation
initializeClassificationTable
insert
isAlphaNumeric
Answer whether the receiver is a letter or a digit.
isCharacter
isDigit
isLetter
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isLowercase
isOctetCharacter
isSafeForHTTP
whether a character is 'safe', or needs to be escaped when used, eg, in a URL
isSeparator
Answer whether the receiver is one of the separator characters--space,
cr, tab, line feed, or form feed.
isSpecial
Answer whether the receiver is one of the special characters
isTraditionalDomestic
Yoshiki's note about #isUnicode says:
[This method] is for the backward compatibility when we had domestic
traditional encodings for CJK languages. To support loading the
projects in traditional domestic encodings (From Nihongo4), and load
some changesets. Once we decided to get rid of classes like JISX0208
from the EncodedCharSet table, the need for isUnicode will not be
necessary.
I (Andreas) decided to change the name from isUnicode to #isTraditionalDomestic
since I found isUnicode to be horribly confusing (how could the character *not*
be Unicode after all?). But still, we should remove this method in due time.
isUppercase
isVowel
Answer whether the receiver is one of the vowels, AEIOU, in upper or
lower case.
javascriptOn:
join:
leadingChar
leadingChar:code:
lf
linefeed
macRomanToUnicode
Convert the receiver from MacRoman Unicode.
nbsp
new
newPage
objectForDataStream:
I am being collected for inclusion in a segment. Do not include Characters! Let them be in outPointers.
pageDown
pageUp
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
printOnStream:
sameAs:
Answer whether the receiver is equal to aCharacter, ignoring case
separators
setValue:
space
storeBinaryOn:
Store the receiver on a binary (file) stream
storeOn:
Common character literals are preceded by '$', however special need to be encoded differently: for some this might be done by using one of the shortcut constructor methods for the rest we have to create them by ascii-value.
tab
to:
Answer with a collection in ascii order -- $a to: $z
tokenish
Answer whether the receiver is a valid token-character--letter, digit, or
colon.
unicodeToMacRoman
Convert the receiver from Unicode to MacRoman encoding.
value:
veryDeepCopyWith:
Return self. I can't be copied.
String
A String is an indexed collection of Characters. Class String provides the abstract super class for ByteString (that represents an array of 8-bit Characters) and WideString (that represents an array of 32-bit characters). In the similar manner of LargeInteger and SmallInteger, those subclasses are chosen accordingly for a string; namely as long as the system can figure out so, the String is used to represent the given string.
Strings support a vast array of useful methods, which can best be learned by browsing and trying out examples as you find them in the code.
Here are a few useful methods to look at...
String match:
String contractTo:
String also inherits many useful methods from its hierarchy, such as
SequenceableCollection ,
SequenceableCollection copyReplaceAll:with:
*
+
-
/
//
<
Answer whether the receiver sorts before aString.
The collation order is simple ascii (with case differences).
<=
Answer whether the receiver sorts before or equal to aString.
The collation order is simple ascii (with case differences).
=
Answer whether the receiver sorts equally as aString.
The collation order is simple ascii (with case differences).
>
Answer whether the receiver sorts after aString.
The collation order is simple ascii (with case differences).
>=
Answer whether the receiver sorts after or equal to aString.
The collation order is simple ascii (with case differences).
\\
adaptToCollection:andSend:
If I am involved in arithmetic with a collection, convert me to a number.
adaptToNumber:andSend:
If I am involved in arithmetic with a number, convert me to a number.
adaptToPoint:andSend:
If I am involved in arithmetic with a point, convert me to a number.
adaptToString:andSend:
If I am involved in arithmetic with a string, convert us both to
numbers, and return the printString of the result.
addToMetacelloPackages:
addToMetacelloRepositories:
alike:
Answer some indication of how alike the receiver is to the argument, 0 is no match, twice aString size is best score. Case is ignored.
allRangesOfRegexMatches:
allRegexMatches:
applyLanguageInfomation:
asAlphaNumeric:extraChars:mergeUID:
Generates a String with unique identifier ( UID ) qualities, the difference to a
UUID is that its beginning is derived from the receiver, so that it has a meaning
for a human reader.
Answers a String of totalSize, which consists of 3 parts
1.part: the beginning of the receiver only consisting of
a-z, A-Z, 0-9 and extraChars in Collection additionallyAllowed ( which can be nil )
2.part: a single _
3.part: a ( random ) UID of size >= minimalSizeOfRandomPart consisting of
a-z, A-Z, 0-9
Starting letters are capitalized.
TotalSize must be at least 1.
Exactly 1 occurrence of $_ is guaranteed ( unless additionallyAllowed includes $_ ).
The random part has even for small sizes good UID qualitites for many practical purposes.
If only lower- or uppercase letters are demanded, simply convert the answer with
say #asLowercase. The probability of a duplicate will rise only moderately ( see below ).
Example:
size of random part = 10
in n generated UIDs the chance p of having non-unique UIDs is
n = 10000 -> p < 1e-10 if answer is reduced to lowerCase: p < 1.4 e-8
n = 100000 -> p < 1e-8
at the bottom is a snippet for your own calculations
Note: the calculated propabilites are theoretical,
for the actually used random generator they may be much worse
asByteArray
Convert to a ByteArray with the ascii values of the string.
asByteString
Convert the receiver into a ByteString
asCapitalizedPhrase
asCharacter
Answer the receiver's first character, or a * if none. Idiosyncratic, provisional.
asDate
Many allowed forms, see Date>>#readFrom:
asDateAndTime
Convert from UTC format
asDefaultDecodedString
asDisplayText
Answer a DisplayText whose text string is the receiver.
asDuration
convert from [nnnd]hh:mm:ss[.nanos] format. [] implies optional elements
asFileName
Answer a String made up from the receiver that is an acceptable file
name.
asFourCode
asFunction:
asHex
asHttpResponseTo:
asIRCLowercase
Answer a String made up from the receiver whose characters are all
lowercase, where 'lowercase' is by IRC's definition
asIdentifier:
Return a legal identifier, with first character in upper case if shouldBeCapitalized is true, else lower case. This will always return a legal identifier, even for an empty string
asInteger
asIpByteArray
asLegalSelector
asLowercase
Answer a String made up from the receiver whose characters are all
lowercase.
asMIMEDocument
asMIMEDocumentType:
asMIMEType
asMetacelloVersionNumber
asMorph
Answer the receiver as a StringMorph
asNumber
Answer the Number created by interpreting the receiver as the string
representation of a number.
asOctetString
Convert the receiver into an octet string
asPacked
Convert to a longinteger that describes the string
asParagraph
Answer a Paragraph whose text string is the receiver.
asPluralBasedOn:
Append an 's' to this string based on whether aNumberOrCollection is 1 or of size 1.
asRegex
Compile the receiver as a regex matcher. May raise RxParser>>syntaxErrorSignal
or RxParser>>compilationErrorSignal.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
asRegexIgnoringCase
Compile the receiver as a regex matcher. May raise RxParser>>syntaxErrorSignal
or RxParser>>compilationErrorSignal.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
asRepository
asSignedInteger
Returns the first signed integer it can find or nil.
asSmalltalkComment
return this string, munged so that it can be treated as a comment in Smalltalk code. Quote marks are added to the beginning and end of the string, and whenever a solitary quote mark appears within the string, it is doubled
asSqueakPathName
asString
Answer this string.
asStringMorph
Answer the receiver as a StringMorph
asStringOrText
Answer this string.
asSymbol
Answer the unique Symbol whose characters are the characters of the
string.
asText
Answer a Text whose string is the receiver.
asTime
Many allowed forms, see Time>>readFrom:
asTimeStamp
Convert from obsolete TimeStamp format
asURI
convert to a Url
asURIForceEncoding
convert to a Url after we do the HTTP string safe encoding
asUnsignedInteger
Returns the first integer it can find or nil.
asUppercase
Answer a String made up from the receiver whose characters are all
uppercase.
asUrl
convert to a Url
asUrlRelativeTo:
asVmPathName
asWideString
base64Decoded
Decode the receiver from base 64
base64Encoded
Encode the receiver as base64
basicType
Answer a symbol representing the inherent type of the receiver
beginsWithEmpty:caseSensitive:
Answer whether the receiver begins with the given prefix string.
The comparison is case-sensitive.
browserIcon
byteAt:
byteAt:put:
byteEncode:
byteSize
capitalized
Return a copy with the first letter capitalized
caseInsensitiveLessOrEqual:
Answer whether the receiver sorts before or equal to aString.
The collation order is case insensitive.
caseSensitiveLessOrEqual:
Answer whether the receiver sorts before or equal to aString.
The collation order is case sensitive.
charactersExactlyMatching:
Do a character-by-character comparison between the receiver and aString. Return the index of the final character that matched exactly.
compare:
Answer a comparison code telling how the receiver sorts relative to aString:
1 - before
2 - equal
3 - after.
The collation sequence is ascii with case differences ignored.
To get the effect of a <= b, but ignoring case, use (a compare: b) <= 2.
compare:caseSensitive:
Answer a comparison code telling how the receiver sorts relative to aString:
1 - before
2 - equal
3 - after.
compare:with:collated:
compressWithTable:
Return a string with all substrings that occur in tokens replaced
by a character with ascii code = 127 + token index.
This will work best if tokens are sorted by size.
Assumes this string contains no characters > 127, or that they
are intentionally there and will not interfere with this process.
contractTo:
return myself or a copy shortened by ellipsis to smallSize
convertFromEncoding:
convertFromSuperSwikiServerString
convertFromWithConverter:
convertToEncoding:
convertToSuperSwikiServerString
convertToSystemString
convertToWithConverter:
copyReplaceTokens:with:
Replace all occurrences of oldSubstring that are surrounded
by non-alphanumeric characters
copyWithRegex:matchesReplacedWith:
copyWithRegex:matchesTranslatedUsing:
correctAgainst:
Correct the receiver: assume it is a misspelled word and return the (maximum of five) nearest words in the wordList. Depends on the scoring scheme of alike:
correctAgainst:continuedFrom:
Like correctAgainst:. Use when you want to correct against several lists, give nil as the first oldCollection, and nil as the last wordList.
correctAgainstDictionary:continuedFrom:
Like correctAgainst:continuedFrom:. Use when you want to correct against a dictionary.
correctAgainstEnumerator:continuedFrom:
The guts of correction, instead of a wordList, there is a block that should take another block and enumerate over some list with it.
cr
crc16
Compute a 16 bit cyclic redundancy check.
crlf
crlfcrlf
decodeMimeHeader
See RFC 2047, MIME Part Three: Message Header Extension for Non-ASCII
Text. Text containing non-ASCII characters is encoded by the sequence
=?character-set?encoding?encoded-text?=
Encoding is Q (quoted printable) or B (Base64), handled by
Base64MimeConverter / RFC2047MimeConverter.
Thanks to Yokokawa-san, it works in m17n package. Try the following:
'=?ISO-2022-JP?B?U1dJS0lQT1AvGyRCPUJDKyVpJXMlQRsoQi8=?= =?ISO-2022-JP?B?GyRCJVElRiUjJSobKEIoUGF0aW8p?=' decodeMimeHeader.
decodeQuotedPrintable
Assume receiver is in MIME 'quoted-printable' encoding, and decode it.
deepCopy
DeepCopy would otherwise mean make a copy of the character; since
characters are unique, just return a shallowCopy.
displayAt:
Display the receiver as a DisplayText at aPoint on the display screen.
displayOn:
Display the receiver on the given DisplayMedium. 5/16/96 sw
displayOn:at:
Show a representation of the receiver as a DisplayText at location aPoint on aDisplayMedium, using black-colored text.
displayOn:at:textColor:
Show a representation of the receiver as a DisplayText at location aPoint on aDisplayMedium, rendering the text in the designated color
displayProgressAt:from:to:during:
Display this string as a caption over a progress bar while workBlock is evaluated.
EXAMPLE (Select next 6 lines and Do It)
'Now here''s some Real Progress'
displayProgressAt: Sensor cursorPoint
from: 0 to: 10
during: [:bar |
1 to: 10 do: [:x | bar value: x.
(Delay forMilliseconds: 500) wait]].
HOW IT WORKS (Try this in any other language :-)
Since your code (the last 2 lines in the above example) is in a block,
this method gets control to display its heading before, and clean up
the screen after, its execution.
The key, though, is that the block is supplied with an argument,
named 'bar' in the example, which will update the bar image every
it is sent the message value: x, where x is in the from:to: range.
do:toFieldNumber:
Considering the receiver as a holder of tab-delimited fields, evaluate aBlock on behalf of a field in this string
encodeDoublingQuoteOn:
Print inside string quotes, doubling inbedded quotes.
encodeForHTTP
change dangerous characters to their %XX form, for use in HTTP transactions
encodeForHTTPAlternate
change dangerous characters to their %XX form, for use in HTTP transactions
encodeForHTTPAlternateSkipSlashColon
change dangerous characters to their %XX form, for use in HTTP transactions
encodeForHTTPWithTextEncoding:
encodeForHTTPWithTextEncoding:conditionBlock:
change dangerous characters to their %XX form, for use in HTTP transactions
encodeOn:
endsWith:
Answer whether the tail end of the receiver is the same as suffix.
The comparison is case-sensitive.
endsWithAColon
Answer whether the final character of the receiver is a colon
endsWithAnyOf:
endsWithDigit
Answer whether the receiver's final character represents a digit. 3/11/96 sw
escapeEntities
evaluateExpression:parameters:
private - evaluate the expression aString with
aCollection as the parameters and answer the
evaluation result as an string
example
expandMacro:argument:withExpansions:
expandMacros
expandMacrosWith:
expandMacrosWith:with:
expandMacrosWith:with:with:
expandMacrosWith:with:with:with:
expandMacrosWithArguments:
extractNumber
findAnySubStr:startingAt:
Answer the index of the character within the receiver, starting at start, that begins a substring matching one of the delimiters. delimiters is an Array of Strings (Characters are permitted also). If the receiver does not contain any of the delimiters, answer size + 1.
findBetweenSubStrs:
Answer the collection of String tokens that result from parsing self. Tokens are separated by 'delimiters', which can be a collection of Strings, or a collection of Characters. Several delimiters in a row are considered as just one separation.
findCloseParenthesisFor:
assume (self at: startIndex) is $(. Find the matching $), allowing parentheses to nest.
findDelimiters:startingAt:
Answer the index of the character within the receiver, starting at start, that matches one of the delimiters. If the receiver does not contain any of the delimiters, answer size + 1.
findFirstInString:inCharacterSet:startingAt:
findFirstInString:inSet:startingAt:
findLastOccuranceOfString:startingAt:
findLastOccurrenceOfString:startingAt:
Answer the index of the last occurrence of subString within the receiver, starting at start. If
the receiver does not contain subString, answer 0. Case-sensitive match used.
findSelector
Dan's code for hunting down selectors with keyword parts; while this doesn't give a true parse, in most cases it does what we want, in where it doesn't, we're none the worse for it.
findString:
Answer the index of subString within the receiver, starting at start. If
the receiver does not contain subString, answer 0.
findString:startingAt:
Answer the index of subString within the receiver, starting at start. If
the receiver does not contain subString, answer 0.
findString:startingAt:caseSensitive:
Answer the index in this String at which the substring key first occurs,
at or beyond start. The match can be case-sensitive or not. If no match
is found, zero will be returned.
findSubstring:in:startingAt:matchTable:
Answer the index in the string body at which the substring key first occurs, at or beyond start. The match is determined using matchTable, which can be used to effect, eg, case-insensitive matches. If no match is found, zero will be returned.
findTokens:
Answer the collection of tokens that result from parsing self. Return strings between the delimiters. Any character in the Collection delimiters marks a border. Several delimiters in a row are considered as just one separation. Also, allow delimiters to be a single character.
findTokens:escapedBy:
Answer a collection of Strings separated by the delimiters, where
delimiters is a Character or collection of characters. Two delimiters in a
row produce an empty string (compare this to #findTokens, which
treats sequential delimiters as one).

The characters in quoteDelimiters are treated as quote characters, such
that any delimiter within a pair of matching quoteDelimiter characters
is treated literally, rather than as a delimiter.

The quoteDelimiter characters may be escaped within a quoted string.
Two sequential quote characters within a quoted string are treated as
a single character.

This method is useful for parsing comma separated variable strings for
spreadsheet import and export.
findTokens:includes:
Divide self into pieces using delimiters. Return the piece that includes subString anywhere in it. Is case sensitive (say asLowercase to everything beforehand to make insensitive).
findTokens:keep:
Answer the collection of tokens that result from parsing self. The tokens are seperated by delimiters, any of a string of characters. If a delimiter is also in keepers, make a token for it. (Very useful for carriage return. A sole return ends a line, but is also saved as a token so you can see where the line breaks were.)
findWordStart:startingAt:
HyperCard style searching. Answer the index in self of the substring key, when that key is preceeded by a separator character. Must occur at or beyond start. The match is case-insensitive. If no match is found, zero will be returned.
format:
format the receiver with aCollection

simplest example:
'foo {1} bar' format: {Date today}.

complete example:
'\{ \} \\ foo {1} bar {2}' format: {12. 'string'}.
fromByteArray:
fromPacked:
fromString:
getEnclosedExpressionFrom:
private - get the expression enclosed between '{' and
'}' and remove all the characters from the stream
getInteger32:
hasContentsInExplorer
hasWideCharacterFrom:to:
Return true if one of my character in the range does not fit in a single byte
hash
#hash is implemented, because #= is implemented
howManyMatch:
Count the number of characters that match up in self and aString.
includesSubString:
includesSubstring:caseSensitive:
includesUnifiedCharacter
indentationIfBlank:
Answer the number of leading tabs in the receiver. If there are
no visible characters, pass the number of tabs to aBlock and return its value.
indexOf:
Answer the index of the first occurence of anElement within the
receiver. If the receiver does not contain anElement, answer 0.
indexOf:startingAt:
indexOf:startingAt:ifAbsent:
Answer the index of the first occurence of anElement after start
within the receiver. If the receiver does not contain anElement,
answer the result of evaluating the argument, exceptionBlock.
indexOfAnyOf:
returns the index of the first character in the given set. Returns 0 if none are found
indexOfAnyOf:ifAbsent:
returns the index of the first character in the given set. Returns the evaluation of aBlock if none are found
indexOfAnyOf:startingAt:
returns the index of the first character in the given set, starting from start. Returns 0 if none are found
indexOfAnyOf:startingAt:ifAbsent:
returns the index of the first character in the given set, starting from start
indexOfAscii:inString:startingAt:
indexOfFirstUppercaseCharacter
indexOfSubCollection:
indexOfSubCollection:startingAt:ifAbsent:
Answer the index of the receiver's first element, such that that element
equals the first element of sub, and the next elements equal
the rest of the elements of sub. Begin the search at element
start of the receiver. If no such match is found, answer the result of
evaluating argument, exceptionBlock.
initialIntegerOrNil
Answer the integer represented by the leading digits of the receiver, or nil if the receiver does not begin with a digit
initialize
Subclasses should redefine this method to perform initializations on instance creation
isAllDigits
whether the receiver is composed entirely of digits
isAllSeparators
whether the receiver is composed entirely of separators
isAsciiString
isBogus
isByteString
Answer whether the receiver is a ByteString
isLiteral
Answer whether the receiver has a literal text form recognized by the
compiler.
isOctetString
Answer whether the receiver can be represented as a byte string.
This is different from asking whether the receiver *is* a ByteString
(i.e., #isByteString)
isPositiveInteger
isString
Overridden to return true in String, natch
isWideString
Answer whether the receiver is a WideString
javascriptOn:
join:
NB: this implementation only works for Array, since WriteStreams only work for Arrays and Strings. (!)
Overridden in OrderedCollection and SortedCollection.
keywords
Answer an array of the keywords that compose the receiver.
lastIndexOfPKSignature:
Answer the last index in me where aSignature (4 bytes long) occurs, or 0 if not found
lastSpacePosition
Answer the character position of the final space or other separator character in the receiver, and 0 if none
leadingCharRunLengthAt:
lf
lineCorrespondingToIndex:
Answer a string containing the line at the given character position. 1/15/96 sw: Inefficient first stab at this
lineCount
Answer the number of lines represented by the receiver, where every cr adds one line. 5/10/96 sw
lineNumber:
Answer a string containing the characters in the given line number. 5/10/96 sw
linesDo:
execute aBlock with each line in this string. The terminating CR's are not included in what is passed to aBlock
loadRequiredForMetacelloMCVersion:
match:
Answer whether text matches the pattern in this string.
Matching ignores upper/lower case differences.
Where this string contains #, text may contain any character.
Where this string contains *, text may contain any sequence of characters.
matchesRegex:
Test if the receiver matches a regex. May raise RxParser>>regexErrorSignal or
child signals.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
matchesRegexIgnoringCase:
Test if the receiver matches a regex. May raise RxParser>>regexErrorSignal or
child signals.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
mergeIntoMetacelloPackages:
mergeIntoMetacelloRepositories:
metacelloIntegerLessThanSelf:
integer version components are always '>' string component
metacelloStringLessThanSelf:
metacelloVersionComponentLessThan:
new:
niDescription
niLabel
nsReadStreamClass
nsWriteStreamClass
numArgs
Answer either the number of arguments that the receiver would take if considered a selector. Answer -1 if it couldn't be a selector. It is intended mostly for the assistance of spelling correction.
numericSuffix
occursInWithEmpty:caseSensitive:
Answer whether the receiver begins with the given prefix string.
The comparison is case-sensitive.
onlyLetters
answer the receiver with only letters
openInWorkspaceWithTitle:
Open up a workspace with the receiver as its contents, with the given title
packageFileSpecFor:
padded:to:with:
prefixMatchesRegex:
Test if the receiver's prefix matches a regex.
May raise RxParser class>>regexErrorSignal or child signals.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
prefixMatchesRegexIgnoringCase:
Test if the receiver's prefix matches a regex.
May raise RxParser class>>regexErrorSignal or child signals.
This is a part of the Regular Expression Matcher package, (c) 1996, 1999 Vassili Bykov.
Refer to `documentation' protocol of RxParser class for details.
printOn:
Print inside string quotes, doubling inbedded quotes.
putInteger32:at:
putOn:
readFrom:
regex:matchesCollect:
regex:matchesDo:
removeFromMetacelloPackages:
removeFromMetacelloRepositories:
renderOn:
Override this method to customize how objects (not components) are rendered when passed as an argument to #render:. The default is the return value of #displayString.
Just remember that you can not use #callback:, #on:of:, or #call:
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
resolvePackageSpecsNamedForMetacelloMCVersion:visited:ifAbsent:
romanNumber
sameAs:
Answer whether the receiver sorts equal to aString. The
collation sequence is ascii with case differences ignored.
sansPeriodSuffix
Return a copy of the receiver up to, but not including, the first period. If the receiver's *first* character is a period, then just return the entire receiver.
service
serviceOrNil
setAuthorInMetacelloConfig:
setAuthorInMetacelloVersion:
setBlessingInMetacelloConfig:
setBlessingInMetacelloVersion:
setDescriptionInMetacelloConfig:
setDescriptionInMetacelloVersion:
setIncludesInMetacelloPackage:
setLoadsInMetacelloProject:
setPackage:withInMetacelloConfig:
setProject:withInMetacelloConfig:
setRequiresInMetacelloPackage:
setTimestampInMetacelloConfig:
setTimestampInMetacelloVersion:
skipAnySubStr:startingAt:
Answer the index of the last character within the receiver, starting at start, that does NOT match one of the delimiters. delimiters is a Array of substrings (Characters also allowed). If the receiver is all delimiters, answer size + 1.
skipDelimiters:startingAt:
Answer the index of the character within the receiver, starting at start, that does NOT match one of the delimiters. If the receiver does not contain any of the delimiters, answer size + 1. Assumes the delimiters to be a non-empty string.
space
splitInteger
Answer an array that is a splitting of self into a string and an integer.
'43Sam' ==> #(43 'Sam'). 'Try90' ==> #('Try' 90)
BUT NOTE: 'Sam' ==> #('Sam' 0), and '90' ==> #('' 90) ie, (<string> <integer>).
startingAt:match:startingAt:
Answer whether text matches the pattern in this string.
Matching ignores upper/lower case differences.
Where this string contains #, text may contain any character.
Where this string contains *, text may contain any sequence of characters.
startsWithDigit
Answer whether the receiver's first character represents a digit
stemAndNumericSuffix
Parse the receiver into a string-valued stem and a numeric-valued suffix. 6/7/96 sw
storeOn:
Print inside string quotes, doubling inbedded quotes.
string
stringHash:initialHash:
stringRepresentation
Answer a string that represents the receiver. For most objects this is simply its printString, but for strings themselves, it's themselves, to avoid the superfluous extra pair of quotes. 6/12/96 sw
stringhash
subStrings
Answer an array of the substrings that compose the receiver.
subStrings:
Answer an array containing the substrings in the receiver separated
by the elements of separators.
substrings
Answer an array of the substrings that compose the receiver.
surroundedBySingleQuotes
Answer the receiver with leading and trailing quotes.
tab
tabDelimitedFieldsDo:
Considering the receiver as a holder of tab-delimited fields, evaluate execute aBlock with each field in this string. The separatilng tabs are not included in what is passed to aBlock
translate:from:to:table:
translateFrom:to:table:
translate the characters in the string by the given table, in place
translateToLowercase
Translate all characters to lowercase, in place
translateToUppercase
Translate all characters to lowercase, in place
translateWith:
translate the characters in the string by the given table, in place
translated
answer the receiver translated to the default language
translatedIfCorresponds
answer the receiver translated to the default language only if
the receiver begins and ends with an underscore (_)
translatedTo:
answer the receiver translated to the given locale id
trimBlanks
truncateTo:
return myself or a copy shortened to smallSize. 1/18/96 sw
truncateWithElipsisTo:
Return myself or a copy suitably shortened but with elipsis added
unescapePercents
decode %xx form. This is the opposite of #encodeForHTTP
unescapePercentsWithTextEncoding:
decode string including %XX form
unparenthetically
If the receiver starts with (..( and ends with matching )..), strip them
unzipped
value:
with:
withBlanksCondensed
Return a copy of the receiver with leading/trailing blanks removed
and consecutive white spaces condensed.
withBlanksTrimmed
Return a copy of the receiver from which leading and trailing blanks have been trimmed.
withCRs
Return a copy of the receiver in which backslash (\) characters have been replaced with carriage returns.
withFirstCharacterDownshifted
Return a copy with the first letter downShifted
withInternetLineEndings
change line endings from CR's to CRLF's. This is probably in
prepration for sending a string over the Internet
withNoLineLongerThan:
Answer a string with the same content as receiver, but rewrapped so that no line has more characters than the given number
withSeparatorsCompacted
replace each sequences of whitespace by a single space character
withSqueakLineEndings
assume the string is textual, and that CR, LF, and CRLF are all
valid line endings. Replace each occurence with a single CR
withoutJustTrailingDigits
Answer the portion of the receiver that precedes any trailing series of digits. If the receiver consists entirely of digits and blanks, return an empty string
withoutLeadingBlanks
Return a copy of the receiver from which leading blanks have been
trimmed.
withoutLeadingDigits
Answer the portion of the receiver that follows any leading series of digits and blanks. If the receiver consists entirely of digits and blanks, return an empty string
withoutQuoting
remove the initial and final quote marks, if present
withoutTrailingBlanks
Return a copy of the receiver from which trailing blanks have been trimmed.
withoutTrailingDigits
Answer the portion of the receiver that precedes any trailing series of digits and blanks. If the receiver consists entirely of digits and blanks, return an empty string
wordBefore:
writeLeadingCharRunsOn:
zipped
Symbol
I represent Strings that are created uniquely. Thus, someString asSymbol == someString asSymbol.
=
Compare the receiver and aSymbol.
allSymbolTablesDo:
allSymbolTablesDo:after:
allSymbols
asMutator
Return a setter message from a getter message. For example,
#name asMutator returns #name:
asString
Refer to the comment in String|asString.
asSymbol
Refer to the comment in String|asSymbol.
at:put:
You cannot modify the receiver.
byteEncode:
capitalized
Return a copy with the first letter capitalized
clone
Answer with the receiver, because Symbols are unique.
compactSymbolTable
copy
Answer with the receiver, because Symbols are unique.
errorNoModification
findInterned:
flushCache
Tell the interpreter to remove all entries with this symbol as a selector from its method lookup cache, if it has one. This primitive must be called whenever a method is defined or removed.
NOTE: Only one of the two selective flush methods needs to be used.
Squeak 2.3 and later uses 116 (See CompiledMethod flushCache).
hasInterned:ifTrue:
includesKey:
initialize
Subclasses should redefine this method to perform initializations on instance creation
intern:
internCharacter:
isDoIt
isInfix
Answer whether the receiver is an infix message selector.
isKeyword
Answer whether the receiver is a message keyword.
isOrientedFill
Needs to be implemented here because symbols can occupy 'color' slots of morphs.
isPvtSelector
Answer whether the receiver is a private message selector, that is,
begins with 'pvt' followed by an uppercase letter, e.g. pvtStringhash.
isSymbol
isUnary
Answer whether the receiver is an unary message selector.
lookup:
newFrom:
numArgs:
Answer a string that can be used as a selector with n arguments.
TODO: need to be extended to support shrinking and for selectors like #+
possibleSelectorsFor:
precedence
Answer the receiver's precedence, assuming it is a valid Smalltalk
message selector or 0 otherwise. The numbers are 1 for unary,
2 for binary and 3 for keyword selectors.
readFrom:
rehash
Do nothing. Here so sending this to a Set does not have to do a time consuming respondsTo:
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
selectorsContaining:
separateKeywords
shallowCopy
Answer with the receiver, because Symbols are unique.
shutDown:
storeOn:
Print inside string quotes, doubling inbedded quotes.
string:
thatStarts:skipping:
thatStartsCaseSensitive:skipping:
value:
veryDeepCopyWith:
Return self. I am immutable in the Morphic world. Do not record me.
withFirstCharacterDownshifted
Answer an object like the receiver but with first character downshifted if necesary
WideString
This class represents the array of 32 bit wide characters.
allMultiStringMethods
allNonAsciiMethods
asFourCode
asPacked
Convert to a longinteger that describes the string
at:
Answer the Character stored in the field of the receiver indexed by the argument.
at:put:
Store the Character in the field of the receiver indicated by the index.
byteAt:
byteAt:put:
byteSize
copyFrom:to:
Answer a copy of a subset of the receiver, starting from element at
index start until element at index stop.
from:
fromByteArray:
fromPacked:
fromString:
hasWideCharacterFrom:to:
Return true if one of my character in the range does not fit in a single byte
includesUnifiedCharacter
isUnicodeStringWithCJK
isWideString
Answer whether the receiver is a WideString
mutateJISX0208StringToUnicode
replaceFrom:to:with:startingAt:
Primitive. This destructively replaces elements from start to stop in the receiver starting at index, repStart, in the collection, replacement. Answer the receiver. Range checks are performed in the primitive only. Optional. See Object documentation whatIsAPrimitive.
wordAt:
wordAt:put:
WideSymbol
This class represents the symbols containing 32bit characters.
at:
Answer the Character stored in the field of the receiver indexed by the argument.
byteAt:
byteAt:put:
byteSize
fixUponLoad:seg:
We are in an old project that is being loaded from disk.
Fix up conventions that have changed.
initialize
Subclasses should redefine this method to perform initializations on instance creation
isWideString
Answer whether the receiver is a WideString
mutateJISX0208StringToUnicode
pvtAt:put:
Primitive. Store the Character in the field of the receiver indicated by
the index. Fail if the index is not an Integer or is out of bounds, or if
the argument is not a Character. Essential. See Object documentation
whatIsAPrimitive.
species
Answer the preferred class for reconstructing the receiver.
string:
wordAt:
wordAt:put: