Strings

Text is stored in NSString (9.1).

Creation of strings is very easy:

Example:

myStr := 'this is an example of a string' .     " implicit creation by Smalltalk "
aNumber := 333333.888877.
anotherStr := aNumber stringValue.     " conversion to a string "

myStr := NSString stringFromCharArray: #( 65 66 67 68 69 ).     " returns string 'ABCDE' "

They can be concatenated:

Example:

newStr := oldStr stringByAppendingString: ' yes yes yes' .

newStr := oldStr , ' and even more.' .     " short form of string concatenation "



moltalk@moltalk.org      version of this document: V3.0