Jump to content
swindmiller

Remove everything after a period

Recommended Posts

I have a RS object: rs.Fields.item("FreeHardDiskSpace") that outputs like this: 476938.03125

I want to convert it to Gigabytes, so to start I want to remove everything after the period, the rest I think I can handle.

 

I am still very new to all of this and see different ways to do it but am having trouble referencing and displaying it.

 

Right now I use this to display it:

<td>Free Space: <%Response.Write(rs.fields.item("FreeHardDiskSpace").Value)%></td>

Sorry but I need a little hand holding :)

 

Can someone tell me how to strip everything after the period and then how to display it?

 

I was able to accomplish what I wanted with TotalMemory which was showing "8192" by using this:

<%TotalMemory = rs.fields.item("TotalMemory")/1024%><td>Total Memory: <%Response.Write(TotalMemory)%></td>

Thanks,

Scott

Edited by swindmiller
  • Like 1

Share this post


Link to post
Share on other sites

If you're using VBScript, you could round the number:http://www.w3schools.com/vbscript/func_round.aspor just drop the decimal part:http://www.w3schools.com/vbscript/func_int.aspor format it another way:http://www.w3schools.com/vbscript/func_formatnumber.asp

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...