skij
asked on
ASP.NET/C#: Parse String, Get Three Numbers
Using ASP.NET/C#, I would like to parse this:
Round 1 ($12,34|$56.78|$98.76)
So that:
double a = 12.34;
double b = 56.78;
double c = 98.76;
But if the string is like this:
Round 1 ($12,34|$98.76)
double a = 12.34;
double b = 0;
double c = 98.76;
Round 1 ($12,34|$56.78|$98.76)
So that:
double a = 12.34;
double b = 56.78;
double c = 98.76;
But if the string is like this:
Round 1 ($12,34|$98.76)
double a = 12.34;
double b = 0;
double c = 98.76;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If I were a betting man, then I'd say you're probably not going to be dealing with "Round 1" every single time. If such be the case, then you can abstract the 1 away be turning it into a digit search (\d+) in ryancys' suggestion:
Open in new window