Re: printf fix

new topic     » goto parent     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From:  Bernie Ryan
>
>   Brian:
>
>   <snip> if sprintf formated a string as it should

But as a few people have already pointed out, sprintf *does* format a string
'as it should'.  A tab is a defined character (ASCII 9, as someone pointed
out), which doesn't equal a certain number of spaces.  To get the behavior
you're looking for, you could try:

constant tab = repeat( ' ',8)
sequence string
string = sprintf("%sTab Spaces:%s%d",{tab,tab,length(tab)})



>, then a user could
>   use text in the listbox without dealing with adjusting tab stops,
>   because the tabs would have been converted into spaces.

Except that as Robert pointed out, sprintf would have no way to deal with
line position or font size, two things that would absolutely be needed in
order to simulate tab stops.

I think you're trying to use the wrong tool for this job.


Matt Lewis

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu