display lines with numbers same length

Discussions related to Visual Prolog
augustinharrison
Posts: 20
Joined: 28 Jul 2010 1:28

display lines with numbers same length

Unread post by augustinharrison » 17 Jul 2019 12:03

i have an interpreter that uses display. any procedure can write its results using the call to display.
often these result lines have some text then an amount it shows.

display "one example of amt = ", AmoutVariable
display "another example of amt = ", AnotherAmountVariable
on the result page that would show:
one example of amt = 100.00
another example of amt = 200.00

is there a way to make each line the same length and right justify the amount?
possibly using = and or : as the character to split the text from the value, padding to a common length?
aeh

Harrison Pratt
VIP Member
Posts: 283
Joined: 5 Nov 2000 0:01

Re: display lines with numbers same length

Unread post by Harrison Pratt » 17 Jul 2019 13:15

See format in the string class.

Post Reply