Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个数字,如果数字少于 9 位,我想在开头用零填充这个数字。
目前,如果我有一个号码,可以说:
val num = "123"
如果我使用padTo(9,"0")我会得到"123000000"但我想要"000000123"......
padTo(9,"0")
"123000000"
"000000123"
什么是最好的解决方案?
最好在scala中获得解决方案
谢谢