views:

221

answers:

2

How do you insert a "tab" in a string? I thought it was t enclosed in <> , but I do:

'Name <t> Age <t> Occupation'

prints exactly how it's typed. I would like to get

Name    Age     Occupation

instead of

Name <t> Age <t> Occupation
+2  A: 
'Name ', String tab, ' Age ', String tab, ' Occupation'

If String does not understand #tab, you have to :

'Name ', Character tab asString, ' Age ', Character tab asString, ' Occupation'
Damien Cassou
+2  A: 

As Damien noted, you can simply concatenate several calls to String tab to achieve what you wanted. The <t> trick you're trying, though, happens in Squeak-based Smalltalks if you call expandMacros on your string. E.g.,

'Here is<t>a tab and<n>a blank line' expandMacros

This mechanism is generic, and quite easily extensible; see String>>expandMacrosWithArguments: for more information.

Benjamin Pollack
None of those two are working. I'm not using Squeak, I'm using Visual Works. Would that make it a problem?
Yes; they're Squeak-specific. I'll find out the VisualWorks variant for you.
Benjamin Pollack