If you want to ignore the decimals completely you can use the int() function which will return just the integer part of a number. If you want to round to a given number of decimal points, use the round() function.
'Integers only, no rounding lngKBytes = int(lngBytes / 1024) 'Integers only with rounding lngKBytes = round(lngBytes / 1024, 0) Dan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jerome_west00 Sent: 28 June 2005 14:31 To: Dan Powderhill Subject: Re: Drop or Truncate the last charactors Thanks Dan, that works fine. Could I ask you one more thing, how do you get it to get rid of the decimals? Jerome --- In [email protected], "Dan Powderhill" <[EMAIL PROTECTED]> wrote: > 1. A kilobyte is 1024 bytes, not 1000, so you need to divide my 1024, > not just remove the last 3 characters. > > lngBytes = 57344 > lngKBytes = lngBytes / 1024 > > Obviously if the number of bytes isn't a multiple of 1024 you'll get a > decimal value back, and so will need to round to however many decimal > places you need. > > 2. Use the left function:- > > strFileName = "image.jpg" > strFileNamePart = left(strFileName, len(strFileName) - 4) > > Dan > > ________________________________ > > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of > jerome_west00 > Sent: 28 June 2005 12:30 > To: [email protected] > Subject: [AspClassicAnyQuestionIsOk] Drop or Truncate the last > charactors > > > 2 questions if I may, both are needed to get rid of the last > charactors from strings before writing to database > > 1. I can get the file size of an image in bites but want it in kb so I > need to get rid of the last 3 numbers > > 2. I can get the file name as eg "image.jpg" but don't want the ".jpg" > to be written into the database. > > I assume both answers will be very similar. > Thanks in advance > > > > > > > ________________________________ > > YAHOO! GROUPS LINKS > > > > * Visit your group "AspClassicAnyQuestionIsOk > <http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] > Un > subscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . > > > ________________________________ > > > > > [Non-text portions of this message have been removed] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
