convert string to integer

  • Thread starter Thread starter jed
  • Start date Start date
int val = Int32.Parse ("123");
// Will throw exception if the string has invalid characters or it
represents a number that cannot be represented as int value (see below).

(OR)

int val;
bool result = Int32.TryParse ("123", out val);
// result will be true if success, false if parse failed
 
You can use, Convert.ToInt32("88"), if the Int32.Parse() didn't work for you.

Secondly, if you are looking for a mehtod that will convert "One" to digit
1, then you have to implement your own method.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top