Hi,
I want to split integer from string. For that, I have done like this,
- public void Main(string[] args)
- {
- string obj = "Rs. 1 to 100 employees.";
-
- int A = 0;
- int B = 0;
-
- string[] listTurnOver = obj.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
- bool isfist = true;
- for (int i = 0; i < listTurnOver.Count(); i++)
- {
- int temp = 0;
- int.TryParse(listTurnOver[i], out temp);
- if (temp != 0)
- {
- if (isfist)
- {
- A = temp;
- isfist = false;
- }
- else
- {
- B = temp;
- }
- }
- }
- }
Let's say, If my string is containing 3 intergers, then how can I split and assigned to another int vartible?
- string obj2 = "1 to 100 employees with average of 10 percentage.";
-
- int C = 0;
-
-