Re: Tab has 8 spaces .... can it be more or less ? If so HOW? Please !
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Feb 15, 2007
- 531 views
Les Rogers wrote: > .............. output is > HiThere > HiThere > Can I make output > HiThere > HiThere I doubt there is any way to change what the console does when you puts(1,"\t"), but you can pre-process your output. Here is a routine I use in Edita to convert tabs to spaces:
constant SPACE=' ', TAB='\t' global function ExpandTabs(sequence text) -- Replace any tabs with spaces. -- Fast (92,000 lines/second or better) integer tab while 1 do tab=find(TAB,text) if not tab then exit end if text=text[1..tab-1]& repeat(SPACE,isTabWidth-remainder(tab-1,isTabWidth))& text[tab+1..length(text)] end while return text end function
where isTabWidth needs to be set to/defined as 3 for the example you gave. You could of course make this a procedure, say Puts1, which displays to the console rather than 'return text'. HTH, Pete