Search A String To Obtain Substring, Then Remove That Substring?
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
ADVERTISEMENT
I have this sentence
"I like to eat apple"and I need to change it to "i like to eat orange"
i have to check either the string contain apple or not. If yes, then i need to replace the "apple" to "orange" else i done nothing to the string.
can anyone show me how to write this in asp code?
View Replies
View Related
does exist any command to find any substring in a string ? for example if i want to find if there is any + in a string , how can i do this ? Code:
View Replies
View Related
I have records from the database for locations as "Baltimore Service center","Vancouver Service center", "Toronto Service center"...etc.I am trying to get a substring where it diaplays just the location and strips Service center ex : Baltimore
View Replies
View Related
i want to use substring function to peel of first two characters stored in a database field. i'm using sql. im not quite sure what the syntax will be.
Const strSQL as String = "SELECT SUBSTRING(emailKey,2,4), primaryKey FROM Tracker"
i kinda figured out the above statement doesnt work. all i want is extract the first two letters from the emailKey field. any help?
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 to take a string and output it such that the last 4 characters are removed (.txt, .pdf, .doc, etc.)
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
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 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
View Related
I need to obtain the domain from server side code.
Request.Servervariables("URL") doesn't work well... it miss the domain name.
I tried to use the WScript.NetWork object but the domain is not visible.
View Replies
View Related
I am passing the following variables....
City - name of city
RentLow - low range of rent
RentHigh - high range of rent
myquery - keywords
The following is the start of my query string but I am having issues with the City portion already and I have not gotten to the rent yet
I know the SQLquery portion right below is fine - it tested perfectly, along with the rest of the query, it was when I added in the request city string that gives me No value given for one or more required parameters. even though one is passed in the string.
SQLquery = "(" &parsethis(strText ,words ,wCount, 3) & ")"
SQLquery = Replace(SQLquery, "<FIELD1>", "title")
SQLquery = Replace(SQLquery, "<FIELD2>", "description")
SQLquery = Replace(SQLquery, "<FIELD3>", "comments")
SQLstr = "SELECT * FROM links WHERE " & SQLquery & " AND city = " & Request.QueryString("city") & " AND linktype = 2 AND active = " & myTrue & " " & SortSQL & ";"
end if
View Replies
View Related
i ve a string like this : my_name_is_ahmed_adly
now i need to see if this string contains the word "is"
so how can i do this ?
View Replies
View Related
if i have a string with comma seperated words. is there a way to search another string for words that are in it?
View Replies
View Related
I have a page that is not asp that is linking to an asp page with a question mark and a variable on the end of the URL. How can I pull the variable off using server
side processing only?I have tried using ServerVariable("HTTP_REFERER") no good, I tried ServerVariable("URL") no good. I am also using Instr(var,"?") to search the url string like this.
Red1 = Requestor.ServerVariable("URL")
Test1 = Instr(Red1,"?")
Test1 is always a 0 because Red1 is always just the refering URL and I need the whole string in address field. I think that I am using the wrong property but I am not sure what is the right property.
View Replies
View Related
Is there any fast way to search for a specific string within all the files in a folder at a same time?
View Replies
View Related
how to obtain and output that format ( hh:mm:ss.fff ) in my ASP.
View Replies
View Related
I am having some trouble with getting reliable results with a search string I am using in an ASP page that uses embedded SQL.
In the ASP page, I am using checkboxes for the user to select states to search for records that apply to the selected states. Let's say that I checked the states of [GA][VA][TN]. And, let's say that there is a record with a column "states" which has the states of "AL,GA,FL,VA,TN".
The search criteria I use above will not return that record. However, If I use a search criteria that satifies the leading value of "states" or the trailing value of "states" the result will be returned. But since my search criteria 'breaks apart' the actual value of "states", it is not returned in the search. Why, and how can I make this work better?
View Replies
View Related
I've made my first ASP website that interacts with a detabase. All fairly standard: it can display the entire contents of the db, you can input new items, update and delete items, and I've just started making a search page...[!]
It all works fine if the user just searches with one word, but if they enter more than one word and then press search, I don't know how to split their searchstring up into [an array of?] different strings to search the db with.
Is this even the easiest way to do it, or am I just wasting my time?
View Replies
View Related
I am creating a search page and need help writing the code to build the sql
string.
I have 3 fields on the main page which a user can choose to enter search
terms in any of the 3 fields. My question is how do I write the logic so it
only includes the fields in the search criteria where the user has entered
anything.
Fields are
Production No
Production Title
Synopsis
The user may enter any, all or some of the search teams in the fields.
On the search page I am using lots of if conditions to build my sql string
like
strSQL = "Select * from Productions where "
now after where there are lots of permutations and combination like
production no could be empty or it could be filled in and the other fields
might be empty or filled in as well.
Does someone has a simple logic to build the correct sql String?
View Replies
View Related
I'm trying to split my search string, So I can compare search results if the string was of two words such as: "world news"... But i'm a bit confused of how to do it using this code (FOR EXAMPLE): ....
View Replies
View Related
I'm trying to use the Microsoft Search to search for a text string in a folder full of a bunch of ASP files. Seems like the normal "Search for text in files" program in XP Pro won't search between the ASP delimiters <% %> .
How can I search for text strings in ASP a folder full of ASP files with out opening each one individually and searching?
View Replies
View Related
How does one capture the IP address of the user ....and...is there anything 'unique' you can do with this info besides knowing the ip number of his domain/browser?
View Replies
View Related
In a HTML form field, the user enters a long text. I need to search for an image tag. Then get the name of the image (*.gif or *.jpeg) to check the image library if the image already exists. If exists, cannot upload the image. Else, upload the image.
View Replies
View Related
This is probably simple and I'll kick myself when I see the answer, but I am trying to write a simple if statement that will check to see if a string value is contained within a list of string values. In SQL this is a simple matter with syntax like WHERE status IN ('PT', 'PD', 'PDC', 'DIP', 'TIP') I basically want to do the same thing in my ASP page.
I know I can use code like the following and am doing so now. I'm just looking for a more simple method. Code:
View Replies
View Related
I'm trying to build a part of an application that will use an include file based on a user's selection (still in ASP 3.0!). Their selection is stored in a database. I've tried using variables as either the entire include file or in parts of the include file, but nothing I've tried works - I.e.:
myTemplate=objRS("template")
<!-- #include file="inc_<% response.write myTemplate %>.asp" -->
Is there any way to accomplish this?
View Replies
View Related
I'm trying to obtain remote client information to present on a web page using WMI. The problem I have is that no matter how hard I try (and how cross-eyed I get from reading doco) I can't seem to get access to the remote client owing to error 800a0046 - which seems to be a General Access Denied (according to related events in the System Event Log).
I've tried configuring the virtual directory as a highly isolated application, then chaning the account under which it runs to one which has the necessary server access, but with no luck. I've even confirmed via the Component Management console that the process is running under the nominated account. Code:
View Replies
View Related
Is it possible to search a string for a upper case character? Here is what I am trying to do:
I have the following string:
Quote: str = "ProjectSectionPlanning"
I'm trying to break this string into:
Quote: str = "Project Section Planning"
View Replies
View Related
I want to search a string of HTML and insert a querystring into any url where the url is an asp page and is either a local link /folder/page.asp or of a specific domain http://www.somedomain.com/folder/page.asp. It needs to be able to handle plain links and those with querystrings already in there.
I could do it with instr functions etc but I thought this might a good time to brush up on regular expressions. Can anyone point me in the right dirction?
View Replies
View Related
I am trying to build a site for a group which already has a hosting company.
I would like to try to find out which objects are available for use to me.
I do not have admin access to the NT box. Obviously I have permissions in
my area of the server.
I know I can test for specific objects but I'd like to know what is
available, not just what I can test against. Is this even possible? Code:
View Replies
View Related
i get the ref url that come to my site and i want to convert it to find
out what was the query in (google or other searcher sites)
foe example : if someone goes to google and search some text and my
site was in his resaults and he click on it , in my site i see his link
ref like
http://www.google.co.il/search?hl=i...91-Google&meta=
i want to know (in asp and save it to DB) what was the word or words
that the user write in search engine.
View Replies
View Related