zoukankan      html  css  js  c++  java
  • freemarker中的left_pad和right_pad

    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]


  • 相关阅读:
    触发器
    新登录用户的次日成功的留存率
    获取薪水第二多的
    找到薪水比经理高的员工
    成绩排名
    exists 和 in
    sum+case 计数
    前N个员工的salary累计和
    员工的薪水按照salary进行按照1N的排名,相同salary并列
    洛谷2678 跳石头
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315061.html
Copyright © 2011-2022 走看看