Strip All Zeros From A Variable
I'm looking for a easy way to pull all the zeros out of a variable. They can be leading, trailing, or in the middle. I just want them all gone.
View RepliesI'm looking for a easy way to pull all the zeros out of a variable. They can be leading, trailing, or in the middle. I just want them all gone.
View RepliesDoes ASP have any function to remove ZEROS from LEft??
or shoud i write one?
000025120 -> 25120
000000012 -> 12
I need to display the time in military form. I came up with the following:Code:
<%= (hour(now)) & ":" & Minute(now()) & ":" & Second(now()) %>
And this works pretty well, except I get things like this:
8:5:2 for 08:05:02
14:2:17 for 14:02:17 (2:02:17 PM)
How do I get the leading zeros before the number if it is less than 10?
How can I read back info from a database into an input field (in case it's to be edited) that will preserve the zeros to the right of the decimal?The zeros are being preserved in the access database when I have a look at it there. I have the field defined as type "Currency" to two decimal places.
I want to preserve those zeros to the right of the decimal point when I read the record into an input tag on a web page.I am trying to use "FormatCurrency(request.form(exp, 2))" and "FormatNumber(request.form(exp, 2))" but it doesn't help.
is there any way to cause a date such as 6/5/2004 to show up as 06/05/2004? Just didn't know if there was an ASP function to do this or not.
i have found a problem on my webite is when i try to enter details of a new book
into the DB, i input the ISBN as its uniqueID, the problem is that if the ISBN starts with a zero,
(i.e. 07987654) the DB will remove the zero from the start of the ISBN (i.e. 7977654).
Can someone tell me how to force the DB to store the whole number including the zero at the start?
im inserting some data into a number field but when i have something like 0000006 it chops it to 6 in the database. and not always are the same number of zeros present. why im not sure just what i have to work with.
I understand that i could make the db value varchar and just validate it by doing something like Isnumeric. But is there a way to keep my zeros but leave it a number field.
I have a querystring that passes through the value 001 for example, the form on the receiving page need to display that number but with 1 added to it. i have
dim strnum
strnum = request.querystring("value")
strnum = strnum + 1
when displayed <%=strnum%> shows 2 instead of 002, and the zero's are very important, is there any number formating trick i dont know or another way of doing this?i thought about coding the first two zero's in before i call the strnum but this would mess things up when i get to 010 etc.
Anyone know of a good routine for stripping out HTML from a string?
View Replies View RelatedI'm using XMLHTTP to perform a simple screen scraping job.
When I try to have it "scrape" lines with embeded CSS declarations, it
renders them incorrectly, stripping the leading period. Consequently, my CSS
doesn't work.Here's how I'm calling it, but I don't think my implementation is the
problem.
Dim srvXmlHttp
Set srvXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
srvXmlHttp.open "GET", TearURL, false
srvXmlHttp.send()
If srvXmlHttp.status <> 200 Then
Response.Write "No Server Response"
Response.End
End If
Dim strRetval5
strRetval5 = srvXmlHttp.responseText
How can I strip the time part from the Now()?
View Replies View RelatedI have an ASP page which has a form for user to input some information and it gets stored in an Access database. The problem i am having is when a person enters a name with a special character, like Macy's, it gives a Jet database error.
What i am looking for is for a way to remove special characters from the form field in question, like apostrophes, when they tab to the next field. So if they input Macy's, when they go to the next field the previous field gets updated to Macys instead.
We have an unusual situation at the USC School of Medicine; we have to
covert every Web page to a template. The template is too wide to print and a
lot of our students print lectures, notes, etc. We thought we could keep to
the template and draw in the content from other files by using includes. BUT
these files are HTML files and therefore, have Body commands in them. If
this could work, we could put a printable link back to the other page and it
would print. Seems like a great solution except for the extra body commands.
We are using ASP for our scripting.
1. How much of a boondoggle will it be if the files have two body commands
in them. How many browsers would it break?
2. Is there a scripting way around this without creating some objects?
3. Is there something out there -- shareware or commercial -- that would fix
this problem.
4. Could something be done about this using pearl, for example?
We'd really like to do it this way because we can have the users create the
content, use the same file names all the time, thus overwriting the old
file, and the user would never get a chance to screw up the template.
Could someone help me work out out a way to either convert a smalldatetime
value from my database(access) to a normal date with out the trailing time.
Is it simple matter of using FormatDate or does one need to do string
maniupulation?
Current
9/13/2003 11:36:00 AM
What I want:
9/13/2003
I have a field with datetime values like below LISTING 1. me write code strip the time part so only values like "7/15/2005" will be left.
Note - We must be able to strip dates with double digit months and days, so
i can't just use the right function with a hard coded parameter. Code:
Is there a string function to strip the file extension from a variable in ASP? If not any suggestions as to the best way to approach this?
View Replies View RelatedThe following pattern is used to strip HTML tags from a string. I need to remove the tags only if they contain a colon. Is it possible? How can I modify this regexp pattern to match only if a colon exists between the "<" and ">" ? Code:
<[^>]*>
I think a regular expression maybe the solution to the problem I have. My problem is I am pulling a list from a database which I want to list alphabetically. The problem is, the records are stored with a number before them:
eg."762348 - RecordA" --> So I want just the "RecordA" bit so I can list alphabetically.
What I want to do is strip off everything at the beginning up to the first Alphabetic character. Is a regular expression the way to go?
I just want the raw text of a string so I can display a preview of what is in the file.
View Replies View RelatedI have been trying to figure out how to get a function to strip html tags from part of an html file. The way I need it achieved is as so: Code:
<% strOutput = stripHTML("<!--#include file=includes/MyInclude.asp-->") %>
The included file is html-rich, and if included in default.asp, it displays as such. However, as I am attempting to make my website accessible, I wish to be able to strip out the html tags on the included page dynamically.
I have used the following function (and have called it with the above statement) but am getting an error in my functions.asp file: Unexpected quantifier. This is on the line that states Code:
I'm turning my application into a "DLL". Everything worked fine untill I try to do a "While" in my asp code. Then I recieve an error like this:
"Object variable or With block variable not set"
My vb code look like this.....
is there any way of passing a javascript variable over to a asp variable so
i can write it to my database.
Could some help m figure out to strip an unknown range of characters in a path between the first "/" and "/" found in a folder path somewhere on my site. Code:
View Replies View RelatedHow do I convert an ASP variable to a Javascript variable?
View Replies View Relatedsql = "SELECT * FROM & console &'news'"
I got that right now but i want the variable, console to be placed along with news so when it selects from the db it selects from gcnnews or whatever variable it's on. How do I do that?
im trying to subtart one quantity from another then stick the answer in to an update statment, but all i get is an error in syntax message
variable math bit=
qty=request.form("oqty")-Request.form("qty")
sql =
sSQL="Update spares SET spares.location='"&request("location")&_
"',spares.machine='"&request("machine")&_
"',spares.part_desc='"&request("part_desc")&_
"',spares.part_number='"&request("part_number")&_
"',spares.qty='(" & qty & ") "&_
"',spares.min_qty='"&request("min_qty")&_
"',spares.updated_by='"&session("name")&"' WHERE(spares.id)=" & form_id
I need to assign a value to a variable, but this variable name is dependant upon another variable!! I am including the code below so you can see it, cos if not I am sure you are thinking whattt?? Code:
View Replies View RelatedI have many buttons that mapping many textbox, when I click button, I
want to show a string that contains button number( and the mapping
string ), but it failed.
Here is the code:
/////////////////////////////////////////////////////////////////////
<%response.write"<input type='button' name="'btUS95resone"&" a &"'
value='Save' onclick='resone("&a&")'>"%>
function resone(cnt)
{
alert("document.all.txt_note"+cnt)
}
////////////////////////////////////////////////
It seems that the component I called is not there...
Can anybody tell me what is the asp equivalent of the php-phrase:
if (!$Variable) {}
?
Another question: is there a special syntaxis for asp conditions in condition?
I tried this code it doesn t work:
If Condition Then
If 2nd condition Then
ElseIf Then
End If
End If
And it works only when I remove the 2nd condition's End If and the ElseIf. Seems strange, no?
I have a text file that looks like this:
Artist Name: Kiss
Song Title: Rock and Roll All Night
Running Time: 04:38
And I need to be able to get the artist name and song title in asp and display it on a website. The thing is, the text file changes with the song being played on the radio. How can I do this?
I've been given an ASP app written with server side javascript. This app needs to get the username of the person currently logged in to windows (Request.ServerVariables("AUTH_USER") in vbscript). I found a way to get this variable in javascript, but then it wouldn't let me split it (server kept saying method not supported). So I've gave up on getting the username with javascript, and have set variables in VBscript at the top of my page. How do I access those variables within the javascript portion?
View Replies View Relatedi have a textbix name "building" inside my system where the user might input one or several building name in it seperated by a comma. How can i extract each of the value in it? For example, "PG2, PG7, PG6", i want to extract each of them.
View Replies View RelatedI have this url that loads, but in the url is the date, so I need a variable i can use so as the date changes the url is automatically updated,
View Replies View Related