Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.format ?
#2
Macro Macro1820
Code:
Copy      Help
str s = "5"
int z = 2 ;; amount of zero's

s.set('0' s.len z)

out s

With str.format also possible in QM 2.3.3.
Macro Macro1821
Code:
Copy      Help
str s = "5"
int z = 2 ;; amount of zero's

s.formata("%.*m" z '0')

out s
But in this case better is str.set. Your code also OK, when z is not too big. Even shorter is: rep(z) s + "0"


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)