问题
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