Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
convert sting to value (integer) with decimal
Old 12-20-2004, 04:02 PM convert sting to value (integer) with decimal
Junior Talker

Posts: 2
Trades: 0
i have a string called 'strPrice' with the value '12.34'
i need to put it in an integer called intPrice

i use the code:

<%
intPrice = int(strPrice)
%>

But it just rounds it to '12' or '13', remocing the decimal places.

I NEED to keep the decimal places. how can i do this in 1 simple function similar to INT or cINT?

You can email me at avisonjohn@yahoo.co.uk if you need to.

Thank you in advance.
John Avison
avisonjohn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-20-2004, 05:50 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
I think you want to use cDbl()

Although you should be able to do just, intPrice = strPrice, as all variables are defined as Varients anyway.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 12-20-2004, 08:58 PM
Tiggy's Avatar
Ultra Talker

Posts: 249
Location: Lancashire, UK
Trades: 0
I tend to use FormatNumber when working with prices or if you want to add the currency symbol to it and work with it like currency then you should convert it into a currency data type with CCur.

Sorry, I forgot to say that if you are wanting to put it into an integer then your experience is correct - integer types are all whole numbers, double and long integer types can have decimal places. So if you need to work with the decimals then you'd be better off working with something other than an integer.
__________________
Web Site Owner's Resource -
Please login or register to view this content. Registration is FREE

Last edited by Tiggy; 12-20-2004 at 09:03 PM.. Reason: Afterthought
Tiggy is offline
Reply With Quote
View Public Profile
 
Old 10-11-2006, 08:49 PM Re: convert sting to value (integer) with decimal
Junior Talker

Posts: 2
Trades: 0
Cool, i forgot about this thread, was just searching for my username on the internet and found this. cool. forgot why i asked the qeustion, but remember it was for something...... ah well. cheers anyway guys
avisonjohn is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to convert sting to value (integer) with decimal
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49964 seconds with 12 queries