how to convert a string to integer

Thread Solved

Join Date: Jan 2008
Posts: 5
Reputation: savio_1987 is an unknown quantity at this point 
Solved Threads: 0
savio_1987 savio_1987 is offline Offline
Newbie Poster

how to convert a string to integer

 
0
  #1
Apr 6th, 2008
I have a few numeric values in string format,
i need to convert the nos into integer so that i can use them for comparision

e.g
taken the month as 3, but in string it needs to be converted into integer for conversion,

how do i go about in VBscript


thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: how to convert a string to integer

 
0
  #2
Apr 6th, 2008
erm... possibly the wrong forum... maybe the Programming/Scripting forums would get more answers?


Still, in an effort to assist...
If you are dealing with "calendar values"... then you could look up VB finctions for calendar/date/day/month etc.
Alternatively, as you know the likely input, you could do a bunch of If/ElseIf checks, and manually pass though a list of possible string values, and then set them as numerical/integer values instead.

If it's jsut general text to number, you may encounter problems, as different people may input "text values" differently.

Alternatively, if you are simply taking inputs/values that are in "string" form, and want to handle them as "integers" (i.e. they user is inputting the number 3, but the input is set as text instead of integer), then there may be something like Cast or StrToInt for VB ?
Sometimes life holds wonderful suprises - shame I sleep through them all.
http://www.choose-easyweb.com - Not my design, nor my idea :)
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: how to convert a string to integer

 
0
  #3
Apr 6th, 2008
Oh.. .and a quick check in Google...

http://www.codeguru.com/forum/archiv...p/t-15117.html
(sorry folks...)

See if that helps.
Sometimes life holds wonderful suprises - shame I sleep through them all.
http://www.choose-easyweb.com - Not my design, nor my idea :)
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: how to convert a string to integer

 
0
  #4
Apr 7th, 2008
Any chance of you informing others how this was solved if possible... that way others may benefit as well
Sometimes life holds wonderful suprises - shame I sleep through them all.
http://www.choose-easyweb.com - Not my design, nor my idea :)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 2614 | Replies: 3
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC