Smalltalk how to insert a tab in a row

How do you insert a “tab” in a row? I thought this t is enclosed in <>, but I:

'Name <t> Age <t> Occupation'

prints exactly how it prints. I would like to receive

Name    Age     Occupation          

instead

Name <t> Age <t> Occupation
+3
source share
2 answers
'Name ', String tab, ' Age ', String tab, ' Occupation'

If String does not understand #tab, you should:

'Name ', Character tab asString, ' Age ', Character tab asString, ' Occupation'
+3
source

As Damien noted, you can simply concatenate a few challenges String tabto achieve what you want. However, the trick <t>you are trying happens in Squeak-based Smalltalks if you call expandMacroson your line. For example.

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

; . String>>expandMacrosWithArguments: .

+2

Source: https://habr.com/ru/post/1719405/


All Articles