如何在C#中解析String? [英] How to parse the String in C#?
本文介绍了如何在C#中解析String?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C#中解析像1,100000这样的字符串?我想分别得到第一个数字和下一个数字。并在两个数组中保存两个数字。谢谢你的帮助。
解决方案
string [] sa = 1,100000 .Split(' ,');
int a = Convert.ToInt(sa [ 0 ]);
int b = Convert.ToInt(sa [ 1 ]);
How to parse the string like "1,100000" in C# ? I want to respectively get the first number and the next number.And Save two numbers in two arrays. Thank you for your help.
解决方案
string[] sa = "1,100000".Split(','); int a = Convert.ToInt(sa[0]); int b = Convert.ToInt(sa[1]);
这篇关于如何在C#中解析String?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文