Wednesday, 14 July 2010

Convert string to integer for both C# and VB.NET

Simple one to start, how to convert a string to an integer...

in C# use the following code:

string stringOne;
int integerOne;

integerOne = Convert.ToInt32(stringOne);

and in VB.NET :

Dim stringOne as string = nothing
Dim integerOne as integer = nothing

stringOne = "10"
integerOne = Convert.ToInt32(

and a little update today to include PHP :

$aString = "10";
$aNumber= (int)$aString ;

Hope this helps someone out there...keep tuned for more coming soon.

No comments:

Post a Comment