Home Segments Index Top Previous Next

489: Mainline

You can create a string of a given width by using the new: method. For example, the following expression creates a String instance of length 3:

String new: 3 

Next, you can fill a string with spaces using the atAllPut: method.

Workspace
(String new: 3) atAllPut: $  
                           ^ 
                           *-- Space