Solved

What is the easiest way to convert a string to a value

Posted on 2008-09-30
3
175 Views
Last Modified: 2012-05-05
If I have a string called zip and I want to convert it to a value, what is the easiest way to do this.

Example

string zip;
zip = "12345"

int x;
x = val(zip)----------------------------something like that????



0
Comment
Question by:kwh3856
  • 2
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22608155
this should do:

string zip;
zip = "12345" 
int x = int.Parse(zip);

Open in new window

0
 

Author Comment

by:kwh3856
ID: 22608158
I need answer in C# syntax.
0
 

Author Closing Comment

by:kwh3856
ID: 31501665
wow!!! that was fast.  Thanks Angel.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now