You can use int.Parse() and ulong.Parse() to convert from a  string to
an int or unsigned long. You can also use the System.Convert clases.

Here you have some sample code on how to use them:

using System;

namespace ConvertSamples
{
        class myApp
        {
                static void Main()
                {
                        int i;
                        ulong ul;

                        i = int.Parse("123");
                        ul = ulong.Parse("1567");

                        Console.WriteLine(i);
                        Console.WriteLine(ul);

                        i = System.Convert.ToInt32("321");
                        ul = System.Convert.ToUInt64("2002");

                        Console.WriteLine(i);
                        Console.WriteLine(ul);
                }
        }
 |

Federico Raggi
Latam Developers Initiative Manager
Microsoft
 
Phone: (954)489-4862
Mobile: (954)465-4862

> -----Original Message-----
> From: Clint Phillips [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 20, 2002 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Trouble finding atoi() or the like.
> 
> Could someone point me to an atoi() or strtoul() function in the FCL?
Or
> is
> there a std::stringstream equivalent? I don't beleive in rewriting
> functions that already exist. :-)
> 
> Thanks
> 
> You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to