本文介绍了存储值0000001但存储1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿
我要存储值
hey
I want to store a value
int count=0;
count=000000+i; //where i=1
sw.write(count);
它会打印1
但是我想要0000001
请帮助
[edit]添加了C#代码的预标签.大写字母已更正. -PES [/edit]
it prints 1
but I want 0000001
plz help
[edit]pre tag for C# code added. Capitalization corrected. - PES[/edit]
推荐答案
int count = 0;
count = 000000 + i; //where i=1
string customFormat = "000000";
string strVal = count.ToString(customFormat);
sw.write(strVal);
这篇关于存储值0000001但存储1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!