我的字符串看起来像"01","02".是否有一种简单的方法可以将字符串更改为数字,添加1然后将其更改回字符串,以便这些字符串现在看起来像"02","03"等.我不是很擅长C#我刚刚开始,我之前没有得到过价值.
And*_*bel 12
要从字符串到整数,您可以使用int.Parse():
int i = int.Parse("07");
Run Code Online (Sandbox Code Playgroud)
要返回具有特定格式的字符串,您可以使用string.Format():
strings = string.Format("{0:00}",7);
Run Code Online (Sandbox Code Playgroud)
如果我正确理解http://www.csharp-examples.net/string-format-int/,后者应该给出"07" .
| 归档时间: |
|
| 查看次数: |
14114 次 |
| 最近记录: |