gpt4 book ai didi

dart - 如何在 Dart 中保存两位数的整数

转载 作者:行者123 更新时间:2023-12-03 02:48:45 25 4
gpt4 key购买 nike

如何在 Dart 中保存两位数的整数?

int i = 3;
String s = i.toString();
print(s);

结果应该是 03 而不是 3

最佳答案

String s = i.toString().padLeft(2, '0');

关于dart - 如何在 Dart 中保存两位数的整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55359473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com