Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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.
Posted

1 solution

C#
string[] sa = "1,100000".Split(',');
int a = Convert.ToInt(sa[0]);
int b = Convert.ToInt(sa[1]);
 
Share this answer
 
Comments
Richard MacCutchan 31-May-15 12:52pm    
Better to use TryParse in order to catch errors in input data.
Lee Yuan 1-Jun-15 11:32am    
Thank you !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900