freemarker中的left_pad和right_pad
1、简易说明
(1)left_pad 距左边
(2)right_pad 距右边
(3)当仅仅只有一个参数时,插入的是空白;当有两个参数时,插入的是第二个参数符号;如果第二个参数的长度大于1的话,会周期性地插入该符号
2、举例说明
<#--freemarker中的left_pad 距左边-->
[${""?left_pad(8)}]
[${"E"?left_pad(8)}]
[${"EF"?left_pad(8)}]
[${"EFG"?left_pad(8)}]
[${"EFGH"?left_pad(8)}]
[${"EFGHI"?left_pad(8)}]
[${"EFGHIJ"?left_pad(8)}]
[${"EFGHIJK"?left_pad(8)}]
[${"EFGHIJKL"?left_pad(8)}]
[${""?left_pad(8,"*")}]
[${"E"?left_pad(8,"*")}]
[${"EF"?left_pad(8,"*")}]
[${"EFG"?left_pad(8,"*")}]
[${"EFGH"?left_pad(8,"*")}]
[${"EFGHI"?left_pad(8,"*")}]
[${"EFGHIJ"?left_pad(8,"*")}]
[${"EFGHIJK"?left_pad(8,"*")}]
[${"EFGHIJKL"?left_pad(8,"*")}]
[${""?left_pad(8,"?*?")}]
[${"E"?left_pad(8,"?*?")}]
[${"EF"?left_pad(8,"?*?")}]
[${"EFG"?left_pad(8,"?*?")}]
[${"EFGH"?left_pad(8,"?*?")}]
[${"EFGHI"?left_pad(8,"?*?")}]
[${"EFGHIJ"?left_pad(8,"?*?")}]
[${"EFGHIJK"?left_pad(8,"?*?")}]
[${"EFGHIJKL"?left_pad(8,"?*?")}]
<#--freemarker中的right_pad 距右边-->
[${""?right_pad(8)}]
[${"E"?right_pad(8)}]
[${"EF"?right_pad(8)}]
[${"EFG"?right_pad(8)}]
[${"EFGH"?right_pad(8)}]
[${"EFGHI"?right_pad(8)}]
[${"EFGHIJ"?right_pad(8)}]
[${"EFGHIJK"?right_pad(8)}]
[${"EFGHIJKL"?right_pad(8)}]
[${""?right_pad(8,"*")}]
[${"E"?right_pad(8,"*")}]
[${"EF"?right_pad(8,"*")}]
[${"EFG"?right_pad(8,"*")}]
[${"EFGH"?right_pad(8,"*")}]
[${"EFGHI"?right_pad(8,"*")}]
[${"EFGHIJ"?right_pad(8,"*")}]
[${"EFGHIJK"?right_pad(8,"*")}]
[${"EFGHIJKL"?right_pad(8,"*")}]
[${""?right_pad(8,"?*?")}]
[${"E"?right_pad(8,"?*?")}]
[${"EF"?right_pad(8,"?*?")}]
[${"EFG"?right_pad(8,"?*?")}]
[${"EFGH"?right_pad(8,"?*?")}]
[${"EFGHI"?right_pad(8,"?*?")}]
[${"EFGHIJ"?right_pad(8,"?*?")}]
[${"EFGHIJK"?right_pad(8,"?*?")}]
[${"EFGHIJKL"?right_pad(8,"?*?")}]
3、示例结果
[ ]
[ E]
[ EF]
[ EFG]
[ EFGH]
[ EFGHI]
[ EFGHIJ]
[ EFGHIJK]
[EFGHIJKL]
[********]
[*******E]
[******EF]
[*****EFG]
[****EFGH]
[***EFGHI]
[**EFGHIJ]
[*EFGHIJK]
[EFGHIJKL]
[?*??*??*]
[?*??*??E]
[?*??*?EF]
[?*??*EFG]
[?*??EFGH]
[?*?EFGHI]
[?*EFGHIJ]
[?EFGHIJK]
[EFGHIJKL]
[ ]
[E ]
[EF ]
[EFG ]
[EFGH ]
[EFGHI ]
[EFGHIJ ]
[EFGHIJK ]
[EFGHIJKL]
[********]
[E*******]
[EF******]
[EFG*****]
[EFGH****]
[EFGHI***]
[EFGHIJ**]
[EFGHIJK*]
[EFGHIJKL]
[?*??*??*]
[E*??*??*]
[EF??*??*]
[EFG?*??*]
[EFGH*??*]
[EFGHI??*]
[EFGHIJ?*]
[EFGHIJK*]
[EFGHIJKL]