Saraireh
May 23rd, 2002, 06:49 AM
Hi every body!
Could someone help me in converting a string to integer in C#?
Thanks.
Could someone help me in converting a string to integer in C#?
Thanks.
|
Click to See Complete Forum and Search --> : String to integer Saraireh May 23rd, 2002, 06:49 AM Hi every body! Could someone help me in converting a string to integer in C#? Thanks. T. Schmidt May 23rd, 2002, 07:11 AM You can use the System.Convert class. Like this: int iNumber = System.Convert.ToInt32(myString); armtusk May 23rd, 2002, 01:36 PM Easy way of converting a string to an interger int i = Int32.Parse(String); Similarly converting a string to a long is done as long d = Int64.Parse(String); msuttorp May 24th, 2002, 01:29 AM Similar to what armtusk replied, the following also works (just a matter of taste, I think using the same datatypes adds to more consistant code): int i = int.Parse(String); or long d = long.Parse(String); Of course, it also works with doubles and floats . codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |