Right padding a String with Zeros in XSLT

余生长醉 提交于 2021-01-29 06:50:48

问题


I need to right pad this with leading zeros to a length of 3 in the output (which is fixed length text)

Examples:

A becomes A00

AB becomes AB0

ABC becomes ABC

Please help.


回答1:


You could do simply:

substring(concat($your-string, '000'), 1, 3)

Note that this means that "ABCD" becomes "ABC".



来源:https://stackoverflow.com/questions/65317883/right-padding-a-string-with-zeros-in-xslt

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