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
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
'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'
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.