如何在芭蕾舞女演员朗中进行字符串填充

May*_*ran 2 ballerina

我有一个整数值,我想用前导“0”填充这个整数值。我怎么能在芭蕾舞演员中做到这一点?

int i = 1;
Run Code Online (Sandbox Code Playgroud)

预期输出应该是

0000000001
Run Code Online (Sandbox Code Playgroud)

Pub*_*udu 7

您可以io:sprintf()为此使用该功能。以您给出的相同示例为例,

int i = 1;
io:println(io:sprintf("%09d", i));
Run Code Online (Sandbox Code Playgroud)

以上将打印000000001