Remove Last 4 Characters From String
I have this bit of code that stores the current web page address in a Session variable. I want to always remove the last four characters, such as E.asp, or G.asp, or I.asp.
I searched tutorials on string manipulation but all seem to take out a string in the middle of a string and replace it with something. I just want the last 4 characters removed.
View Replies
ADVERTISEMENT
how to take a string and output it such that the last 4 characters are removed (.txt, .pdf, .doc, etc.)
View Replies
View Related
In PHP I'd use the following line:
$parsedfilename = substr($parsedfilename, -4);
But I can't find the same way to do it in vbscript using ASP!
I simply want to strip the last four characters, but leave the rest of the string in tact! As the string could be any length, I don't know a start position.
Surely it's simple and I'm missing something?
View Replies
View Related
I use ASP, but i dont think it matters. I am parsing large text files. some of them have non standard characters. I just want to parse a file and replace anything that is not found on a keyboard in usa. I just want to keep:
A-Z, a-z, 0-9, .,?'"!@#$%^&*()-_=+";:<>/|}{[]`~
everything else i want to remove (asian letters, wacky characters, etc)
View Replies
View Related
Using ASP/VB I need to remove unwanted commas from the end of a field
that will be use in an array. There are items in the field that are
comma separated, so I don't want to remove them, just the end ones,
could be anywhere up to 5 unwanted commas.
Any ideas?
View Replies
View Related
how do I get a reg exp to remove part of a string? -
I have: '/page/txtonly/index.asp' and I want to remove the '/txtonly' to end up with: '/bobby/index.asp'.
View Replies
View Related
Following java script code to get subscriber ID, its value is like 975683678-28_luxap01s.southernlinc.net, I want to leave number there and cut starting _ part, does anybody know how to remove the character starting underscore "_"? the final value is 975683678-28.
<%
subsciberID = Request.ServerVariables("HTTP_X_UP_SUBNO") ;
%>
View Replies
View Related
I currently have a variable that is pulled from a database for currency amount. Ex: 25.99 . I need to remove the decimal place so that the variable is like 2599 instead. How can I use ASP to remove this decimal place?
View Replies
View Related
How would you get the first two characters out of a string variable to make an asp:label respond a certain way. For example:
The string is "F112345678995" I would like to pull the "F1" out so that an asp label will respond "No match".
Is this as clear as mud?? If you need further clarification let me know. Also can you use a trim statement like in VB?
View Replies
View Related
I have several isbn's that are eather 10 or 12 charcters long. I need
to insert a dot . after the fifth character if it is 10 long, and
after the 6th character if it is 12 long. How do I count through the
string and find out if it is 10 or 12 charaters long, then insert the
dot . after the first 5 if it's 10, or after the first 6 if it's 12?
View Replies
View Related
I know there is a way of stripping out special characters from a string however I need a way of stripping out "" marks from a string or what i really want is to replace all double ("") marks in a string with single ('') marks before inserting the string into a database. Is there a way of doing this in ASP?
View Replies
View Related
I'm trying to strip out none alphanumeric characters (and a couple of punctuation marks) from a string before inserting into a database.
I've put in my code below, basically I thought I'd loop through each character in turn and pass it through a regular expression to check its validity. If it passes I'll add it to a global variable ('validString') if it fails I'll remove it.
But I can't get my Mid() function to accept 'i' as a value so it won't loop. Code:
View Replies
View Related
I have these strings which are pulled from a database which contains both
english and chinese characters(big5).
e.g.
Fragrant Rice 10kg Green Dragon?
Broken Rice 10kg G.Elephant?
I want to split the string at the first occurance of the non ascii character so that i can get the english and chinese parts separated.
View Replies
View Related
what is the maximum number of characters that a string variable can hold - i
initially thought it was 256, but after some testing it seems that it can
hold much more than that..
View Replies
View Related
what I would like to do is remove a substring from a full string and display the modified string my basic code should be some like this:
strSearchString = FullString
strSearchFor = "SubString"
If InStr(1, strSearchString, strSearchFor) > 0 then
Response.write (FullString - Substring)
does anyone have any idea how I would go about doing this?
View Replies
View Related
I found a simple date script, which is this:
<%
var_date=date() 'get the current date
var_date=FormatDateTime(var_date,1)
Response.Write(var_date)
Wednesday, September 29, 2004
How can I get this to not display the day of the week, I only want - September 29, 2004
View Replies
View Related
I found a simple date script, which is this:
<%
var_date=date() 'get the current date
var_date=FormatDateTime(var_date,1)
Response.Write(var_date)
%>
Wednesday, September 29, 2004
How can I get this to not display the day of the week, I only want - September 29, 2004.
View Replies
View Related
i have a variable which holds a value like this
stramount=Trim(Request.form("txtamount"))
response.write stramount
the output sometimes is
50.00 or
50 or
50.
if it is 50.
i want to remove the (dot) at the end. can someone tell me how to use the instr function to see if there is a dot at end and if it is there then remove it.
View Replies
View Related
i have problem in removing the gap between two images, pls see the attached image. coz my item name is quite long, i dun wnat it display in horizontal, i want it display as vertical. so i create the images for the character and use ascii to recognized it.
my code is as below:
<td align="left" class="BorderLeft" width="1%">
<%dim word, pic, word1
word = "AAAAABABABBA"
pic = ""
for i = 0 to len(word)-1
word1 = cstr(right(left(word,len(word)-i),1))
pic = asc(word1) & ".gif"%>
<img src="../images/<%=pic%>" border=1 vspace=0 hspace=0>
<%next%>
</td>
View Replies
View Related
How can I remove a cookie from the client in ASP? I'm not talking about setting the value to a blank string and I've tried this:
[vbs]
Response.Cookies("mycookie").Expires = Now()
[/vbs]
and
[vbs]
Response.Cookies("mycookie").Expires = Date() - 100
[/vbs]
Neither of which work.
Is there any way to completley remove the cookie?
View Replies
View Related
can anyone temme the script or style sheet to remove the hearder and footer url address of the web page when printing the pag
View Replies
View Related
How to write asp code to remove duplicates in an array.
For Eg: A()=(1,5,10,15,10,20,5)
After removal of duplicates it should be
A()=(1,5,10,15,20).
View Replies
View Related
The main idea goes like this: I have a textarea, on the right I have a listbox whose elements are loaded from an Oracle Database, I want to have an "Add" Button which when pushed will insert in the textarea the value selected on the listbox between "{ }" (ej, The {white} cat), you can add as many values as you wish and also manually edit the text, and a Submit button which open another ASP page that will check the sintax of the textarea and insert it on the Database.
So far I already have the part which checks the sintax and inserts it on the db, and the listbox with the elements you can insert on the textarea, but my boss really wants the "Add-Remove" feature and I need to finish this for Tuesday
View Replies
View Related
I have image icons that are clickable. I want to remove the hyperlink from around the image.
I tried the STYLE="TEXT-DECORATION: NONE" tag but thats not working. How should I remove the underline from the hypelink.
Code:
strImage = "<A target=""_blank"" href=""document.asp?job="
strImage = strImage & jobid & "&doc=" & filename & """ STYLE="TEXT-DECORATION:NONE">"
strImage = strImage & "<IMG SRC='" & GenerateIcon(rs("filename")) & "'/></A>"
View Replies
View Related
Would search for this but forgot what its called? I wanna remove everything from the left of the camma in a variable:
43,7-3-05
to 7-3-05
View Replies
View Related
I am wanting to create a large dynamic web site with an accessible Text Only version.Instead of creating additional pages for the text only version, is it possible to implement some regular expressions, which remove all the IMG tags from page.
I have found a useful tool at http://tantek.com/favelets/ which removes the CSS from the page but I also need to remove the images.Are regular expressions the best means of doing this?
View Replies
View Related
I have an array like this:Code:
arrColour = split("blue,blue,green,red,purple,blue,green,yellow",",")
What I need to be able to do is to remove all items of the value "blue" from the array. I can just run a dictionary function to delete all duplicate values, because some of them need to be retained. I just need to delete all of them of a particular value. how this can be done?
View Replies
View Related
Response.Write "<TD>" & "<a href= objRS.Delete>Remove</a>" & "</TD></TR>"
I have a basket which people add stuff to that they want to buy. i want a code that allows them to delete the item too. how the basket works is. thy choose a item from stock page and then it adds to a basket table.
View Replies
View Related
I have declared a multidimensional array as follows. dim parray(100,5). Now this array contains some duplicate values. So how to remove duplicate values in this multidimensional array.
View Replies
View Related
How can I get a string from this
22, 32, 43, 23, 44,
to this
22, 32, 43, 23, 44
I want to cut the last coma.
View Replies
View Related
I have a page which takes data in an HTML table, and exports it to an Excel file. It works fine, but I want several things about the spreadsheet to look different from the HTML version. Things like fonts and colors. I think I can use a style sheet for the latter, but I haven't figured out how to remove hyperlinks from some of the items. On the HTML page, the hyperlinks are useful, but I don't want the spreadsheet to have them.
So on my ASP page which builds the Excel file, I have this: ...
View Replies
View Related
used to other languages and using ASP for a particular project. Is there a way in which I can remove the first element from an array and then return the array with remaining elements intact?
View Replies
View Related
I'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
View Replies
View Related