Parsing strings to numeric

  • Thread starter Thread starter michael
  • Start date Start date
M

michael

You can use a custom format specifier to format a numeric to a string... e.g
int i= 2;

string formatSpecifier = "## px";

i.ToString(formatSpecifier);

But given given a string and the custom format specifier used to format it,
how can you parse that string back to a numeric ?

I've searched the documentation yet an answer alludes me.

Michael
 
michael said:
But given given a string and the custom format specifier used to format it,
how can you parse that string back to a numeric ?

I may have misunderstood you needs, but can you not try somehting like :
int myNum = int.Parse( someNumString );

HTH

Tobin
 
You might try a using the UnitConverter class or another class derived from
TypeConverter. I have never used these before, but I believe the purpose is
to parse a string that has non-parsable characters.
 
Back
Top