In Freemarker how do I insert the right number of spaces to place text in a specified column? -


i'm doing simple c code generation using freemarker. generating line following:

#define my_constant                   (0) 

from template of form:

#define ${name}                   (${value}) 

i generating bunch of these , want them come out this

#define my_constant                   (0) #define my_new_constant               (42) #define my_other_constant             (101) 

with values column aligned. there easy way this? need write directive it?

thanks in advance.

you can use right_pad builtin.

#define ${name?right_pad(30)} (${value}) 

see doc here.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -