PC Review


Reply
Thread Tools Rate Thread

convert string to integer

 
 
jed@auto-soft.co.za
Guest
Posts: n/a
 
      10th May 2007
in need an example of converting a string to integer

 
Reply With Quote
 
 
 
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      10th May 2007
try Int32.TryParse

http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> in need an example of converting a string to integer
>



 
Reply With Quote
 
=?Utf-8?B?U2l2YSBN?=
Guest
Posts: n/a
 
      10th May 2007
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

"(E-Mail Removed)" wrote:

> in need an example of converting a string to integer
>
>

 
Reply With Quote
 
=?Utf-8?B?Q2hha3JhdmFydGh5?=
Guest
Posts: n/a
 
      10th May 2007
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
--
Every thing is perfect, as long as you share!!!

Don''t forget to rate the post


"(E-Mail Removed)" wrote:

> in need an example of converting a string to integer
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert string into integer in c# Bob Microsoft C# .NET 6 9th Jun 2008 01:21 AM
How to convert from string to integer? Allen Maki Microsoft Dot NET 2 2nd May 2007 01:05 PM
convert HEX string into integer :) Microsoft C# .NET 3 26th May 2006 08:37 PM
How to convert hex string to integer Tanja Krammer Microsoft C# .NET 3 8th Apr 2006 08:46 PM
Convert integer to string =?Utf-8?B?S2Vu?= Microsoft Access Form Coding 1 15th Mar 2004 01:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.