- private int GetNumber(string str)
- {
- int length = str.Length;
- string output = String.Empty;
- int test = 0;
- bool err = false;
- for(int i=0;i<=length;i++)
- {
- try
- {
- test = Convert.ToInt32(str.Substring(i,1));
- }
- catch
- {
- err = true;
- }
- if (!err)
- output += str.Substring(i,1);
- else
- break;
- }
- return Convert.ToInt32(output);
- }
No comments:
Post a Comment