Padding Zeros in XSLT

戏子无情 提交于 2019-12-19 12:50:19

问题


Is there any function that pads zeros on the left?

The requirements of what I'm trying to do are:

  • We don't know the coming input string length.
  • If it is less than 20 we have to pad zeros on the left side.
  • If the input string length is 10 then we have to pad 10 zeros in the left side.

Example

Input:

1234567899

Output:

00000000001234567899


回答1:


format-number function can be used for this:

<xsl:value-of select="format-number(1234567899, '00000000000000000000')" />


来源:https://stackoverflow.com/questions/15745090/padding-zeros-in-xslt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!