Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strings with variables and variable format field
#1
I understand that a string with variable can be declared in the form :

Quote:F"text{variable1%%-20s}text"

My question is : Is it possible to declare it with a variable field size, in the place of 20 above? It is implied that this variable will be defined prior to this statement.

Many thanks.
#2
Not with F-string. Use str.format and *.

Macro Macro2508
Code:
Copy      Help
str variable1="AAA"
int size=20
str s
s.format("text%*stext" size variable1)
out s
#3
Then you very much - once more - for a perfect advice - solution. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)