Maturity Index: Experimental
+newCreates an instance whose value is set to the empty string.
+new:(unsigned)nCharsCreates an instance whose value is set to the empty string, can hold at least nChars without having to expand.
+str:(STR)aStringCreates an instance whose value is set to a copy of aString. If aString is NULL, creates an instance whose value is set to the empty string.
+sprintf:(STR)format,...Returns a new instace initialized just as the standard C library sprintf(). See the documentation on sprintf() for the formats and variable declarations.
+fromString:aStringCreates an instance whose value is set to aString.
+string:aStringattribute:attribCreates an instance whose value is set to aString and then sends itself an addAttribute: message.
-copyReturns a copy of the receiver with its internal C string copied as well.
-freeFrees the receiver and its internal C string as well.
- (unsigned)hashReturns a hash value based upon the contents of the string held in the receiver.
- (BOOL)isEqual:aStrReturns YES if the string and runarray contained by aStr is equal to the contents of the receiver.
-stringReturns the String instance for this Text object.
-runsReturns the RunArray instance for this Text object.
- (STR)strReturns a pointer to the NULL-terminated C string stored in the receiver.
- (unsigned)sizeReturns the size of the String instance for this Text object. The following all return the same value :
[text size]; [[text string] size]; [[text runs] size];
- (char)charAt:(unsigned)anOffsetReturns the character at anOffset or zero if anOffset is greater than the length of the C string.
- (char)charAt:(unsigned)anOffsetput:(char)aCharReplaces the character at anOffset with aChar and returns the old character which was in that location. Returns zero if anOffset is greater than the length of the C string.
-at:(unsigned)anOffsetinsert:aString
-at:(unsigned)anOffsetinsert:(char*)aStringcount:(int)size
-deleteFrom:(unsigned)pto:(unsigned)q
-concat:b
-concatSTR:(STR)b
-allBoldThis message is equivalent to,
Returns self (the text object).[self makeBoldFrom:0 to:[self size] - 1].
-makeBoldFrom:(unsigned)pto:(unsigned)qAdds a boldface TextAttribute for the characters from index p to q (including the characters at offset p and q). A boldface attribute has emphasiscode equal to 1.
-addAttribute:attributeThis message is equivalent to,
Returns self (the text object).[self addAttribute:attribute from:0 to:[self size] - 1].
-addAttribute:attributefrom:(unsigned)pto:(unsigned)qAdds attribute to the string segments between p and q.
-attributesAt:(unsigned)iReturns an OrdCltn of TextAttribute instances for the character at index i.
- (unsigned)runLengthFor:(unsigned)iReturns the number of remaining characters in the string segment to which the character at position i belongs. If i is the first character of a run, this method returns the size of the run. Otherwise it returns the size minus the index of character in the run.
-asStringEquivalent to string.
-asTextReturns the object itself.
-asParagraphReturns a paragraph for this text object.
-printOn:(IOD)aFilePrints the Text for the string contained by this instance. Returns the receiver.