Below, I'm trying to remove the querystring name& value of "catID=12".
I mananged to isolate the RESULTS part, but I need to be able to strip the
querystring name and it's value, no matter if the value is 1, 2 or 3 digits.
I chose to isolate the part I'd be removing below because I know I can take
it
and run a replace and get correct string, although I hardcoded the qs name.
Basically, I'd like to end up with a function that I could just pass the
name of the querystring and the function would remove the qs name and it's
value.
One other issue, if the querystring name and value are the only part of the
querystring, I need to delete the "?" within the qs.
Any help?
CODE:
sQueryString = "millID=2&catID=12"
iMarker = InStr(sQueryString ,"catID")
mystring= Right(sQueryString ,Len(sQueryString )-iMarker+1)
RESULTS:
mystring=catID=1 10 7731
"scott" <sc***@sbailey.com> wrote in message
news:eC**************@tk2msftngp13.phx.gbl... Below, I'm trying to remove the querystring name& value of "catID=12". I mananged to isolate the RESULTS part, but I need to be able to strip the querystring name and it's value, no matter if the value is 1, 2 or 3 digits. I chose to isolate the part I'd be removing below because I know I can take it and run a replace and get correct string, although I hardcoded the qs name.
Basically, I'd like to end up with a function that I could just pass the name of the querystring and the function would remove the qs name and it's value.
One other issue, if the querystring name and value are the only part of the querystring, I need to delete the "?" within the qs.
Any help?
<%
Function Remove_QS_Parameter(qs, p)
Dim retVal, re
Set re = New RegExp
re.Pattern = "(\?|&)" & p & "=.*?(&|$)"
retVal = re.Replace(qs,"$2")
If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2)
Remove_QS_Parameter = retVal
End Function
CONST qs = "?param1=1¶m2=02¶m3=003"
Response.Write Remove_QS_Parameter(qs,"param1") & "<br>"
Response.Write Remove_QS_Parameter(qs,"param2") & "<br>"
Response.Write Remove_QS_Parameter(qs,"param3") & "<br>"
%>
here's results below: why the paragraph mark? also results are close, but
not right. can you correct, i can't fix your code.
qs: ?param1=1¶m2=02¶m3=003
results:
?param2=02¶m3=003
?param1=1¶m3=003
?param1=1¶m2=02
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl... "scott" <sc***@sbailey.com> wrote in message news:eC**************@tk2msftngp13.phx.gbl... Below, I'm trying to remove the querystring name& value of "catID=12". I mananged to isolate the RESULTS part, but I need to be able to strip the querystring name and it's value, no matter if the value is 1, 2 or 3 digits. I chose to isolate the part I'd be removing below because I know I can take it and run a replace and get correct string, although I hardcoded the qs name.
Basically, I'd like to end up with a function that I could just pass the name of the querystring and the function would remove the qs name and it's value.
One other issue, if the querystring name and value are the only part of the querystring, I need to delete the "?" within the qs.
Any help?
<% Function Remove_QS_Parameter(qs, p) Dim retVal, re Set re = New RegExp re.Pattern = "(\?|&)" & p & "=.*?(&|$)" retVal = re.Replace(qs,"$2") If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2) Remove_QS_Parameter = retVal End Function
CONST qs = "?param1=1¶m2=02¶m3=003" Response.Write Remove_QS_Parameter(qs,"param1") & "<br>" Response.Write Remove_QS_Parameter(qs,"param2") & "<br>" Response.Write Remove_QS_Parameter(qs,"param3") & "<br>" %>
"scott" <sc***@sbailey.com> wrote in message
news:Od**************@TK2MSFTNGP15.phx.gbl... here's results below: why the paragraph mark? also results are close, but not right. can you correct, i can't fix your code.
qs: ?param1=1¶m2=02¶m3=003
results: ?param2=02¶m3=003 ?param1=1¶m3=003 ?param1=1¶m2=02
My code is fine. However, you may be cutting and pasting in a non-standard
way such that the paste operation is interpreting the occurrences of "¶"
as the paragraph entity character. Try the following:
1. Open Outlook Express and highlight the code I provided
2. Hit CTRL+C to copy the text into the copy/paste buffer
3. Open Notepad
4. Hit CTRL+V to paste the copied text into the Notepad window.
5. Hit CTRL+S to save the file. Save the file with a ".asp" extension and
place it somewhere in your web directory
6. Open Internet Explorer and navigate to the newly saved file.
7. Report back on whether or not this solves your problem.
my browser is showing paragraph marks where ampersand marks should be, and
formula is wrong.
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl... "scott" <sc***@sbailey.com> wrote in message news:eC**************@tk2msftngp13.phx.gbl... Below, I'm trying to remove the querystring name& value of "catID=12". I mananged to isolate the RESULTS part, but I need to be able to strip the querystring name and it's value, no matter if the value is 1, 2 or 3 digits. I chose to isolate the part I'd be removing below because I know I can take it and run a replace and get correct string, although I hardcoded the qs name.
Basically, I'd like to end up with a function that I could just pass the name of the querystring and the function would remove the qs name and it's value.
One other issue, if the querystring name and value are the only part of the querystring, I need to delete the "?" within the qs.
Any help?
<% Function Remove_QS_Parameter(qs, p) Dim retVal, re Set re = New RegExp re.Pattern = "(\?|&)" & p & "=.*?(&|$)" retVal = re.Replace(qs,"$2") If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2) Remove_QS_Parameter = retVal End Function
CONST qs = "?param1=1¶m2=02¶m3=003" Response.Write Remove_QS_Parameter(qs,"param1") & "<br>" Response.Write Remove_QS_Parameter(qs,"param2") & "<br>" Response.Write Remove_QS_Parameter(qs,"param3") & "<br>" %>
this is results after changing the qs name, your previous code rendered
paragraph marks. see the problem?
i'm a quadraplegic, i'm in a hospital, can you help me fix a function as
described before? it's really hard for me to type.
?myparam2=02&myparam3=003
?myparam1=1&myparam3=003
?myparam1=1&myparam2=02
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl... "scott" <sc***@sbailey.com> wrote in message news:Od**************@TK2MSFTNGP15.phx.gbl... here's results below: why the paragraph mark? also results are close, but not right. can you correct, i can't fix your code.
qs: ?param1=1¶m2=02¶m3=003
results: ?param2=02¶m3=003 ?param1=1¶m3=003 ?param1=1¶m2=02
My code is fine. However, you may be cutting and pasting in a non-standard way such that the paste operation is interpreting the occurrences of "¶" as the paragraph entity character. Try the following:
1. Open Outlook Express and highlight the code I provided 2. Hit CTRL+C to copy the text into the copy/paste buffer 3. Open Notepad 4. Hit CTRL+V to paste the copied text into the Notepad window. 5. Hit CTRL+S to save the file. Save the file with a ".asp" extension and place it somewhere in your web directory 6. Open Internet Explorer and navigate to the newly saved file. 7. Report back on whether or not this solves your problem.
"scott" <sc***@sbailey.com> wrote in message
news:uu*************@TK2MSFTNGP09.phx.gbl... this is results after changing the qs name, your previous code rendered paragraph marks. see the problem?
i'm a quadraplegic, i'm in a hospital, can you help me fix a function as described before? it's really hard for me to type.
?myparam2=02&myparam3=003 ?myparam1=1&myparam3=003 ?myparam1=1&myparam2=02
I'm sorry to here about your condition. I can empathize as I am also
disabled and have spent considerable time hospitalized. Would it be possible
for you to show my previous reply to a nurse, aide or a computer savvy
visitor? Cutting and pasting the code I provided should be a simple
procedure for anyone who has even a small bit of experience with computers.
I would also strongly recommend that you speak with an occupational
therapist about getting adaptive technologies to facilitate the use of
computers.
i pasted ascii text chris. it's listed below. i'm a c5/c6 quad, just asking
for a little professional courtesy. if you can't fix your code, thanks
anyway.
i'll repost.
your code:
<%
Function Remove_QS_Parameter(qs, p)
Dim retVal, re
Set re = New RegExp
re.Pattern = "(\?|&)" & p & "=.*?(&|$)"
retVal = re.Replace(qs,"$2")
If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2)
Remove_QS_Parameter = retVal
End Function
CONST qs = "?myparam1=1&myparam2=02&myparam3=003"
Response.Write Remove_QS_Parameter(qs,"myparam1") & "<br>"
Response.Write Remove_QS_Parameter(qs,"myparam2") & "<br>"
Response.Write Remove_QS_Parameter(qs,"myparam3") & "<br>"
%>
YOUR RESULTS;
?myparam2=02&myparam3=003
?myparam1=1&myparam3=003
?myparam1=1&myparam2=02
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:Og**************@TK2MSFTNGP10.phx.gbl... "scott" <sc***@sbailey.com> wrote in message news:uu*************@TK2MSFTNGP09.phx.gbl... this is results after changing the qs name, your previous code rendered paragraph marks. see the problem?
i'm a quadraplegic, i'm in a hospital, can you help me fix a function as described before? it's really hard for me to type.
?myparam2=02&myparam3=003 ?myparam1=1&myparam3=003 ?myparam1=1&myparam2=02
I'm sorry to here about your condition. I can empathize as I am also disabled and have spent considerable time hospitalized. Would it be possible for you to show my previous reply to a nurse, aide or a computer savvy visitor? Cutting and pasting the code I provided should be a simple procedure for anyone who has even a small bit of experience with computers. I would also strongly recommend that you speak with an occupational therapist about getting adaptive technologies to facilitate the use of computers.
"scott" <sc***@sbailey.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... i pasted ascii text chris. it's listed below. i'm a c5/c6 quad, just asking for a little professional courtesy. if you can't fix your code, thanks anyway.
i'll repost. your code:
<% Function Remove_QS_Parameter(qs, p) Dim retVal, re Set re = New RegExp re.Pattern = "(\?|&)" & p & "=.*?(&|$)" retVal = re.Replace(qs,"$2") If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2) Remove_QS_Parameter = retVal End Function
CONST qs = "?myparam1=1&myparam2=02&myparam3=003"
Response.Write Remove_QS_Parameter(qs,"myparam1") & "<br>" Response.Write Remove_QS_Parameter(qs,"myparam2") & "<br>" Response.Write Remove_QS_Parameter(qs,"myparam3") & "<br>" %>
YOUR RESULTS;
?myparam2=02&myparam3=003 ?myparam1=1&myparam3=003 ?myparam1=1&myparam2=02
Sigh. I'd be happy to "fix" my code. Just tell me what's wrong with it.
Otherwise, you probably are better off reposting, since I am obviously
missing something. Good luck.
no, it is i who have missed something, i deeply apologize for temporary
stupidity. the medication is affecting my brain more than i thought.
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl... "scott" <sc***@sbailey.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...i pasted ascii text chris. it's listed below. i'm a c5/c6 quad, just asking for a little professional courtesy. if you can't fix your code, thanks anyway.
i'll repost. your code:
<% Function Remove_QS_Parameter(qs, p) Dim retVal, re Set re = New RegExp re.Pattern = "(\?|&)" & p & "=.*?(&|$)" retVal = re.Replace(qs,"$2") If Left(retVal,1) = "&" Then retVal = "?" & Mid(retVal,2) Remove_QS_Parameter = retVal End Function
CONST qs = "?myparam1=1&myparam2=02&myparam3=003"
Response.Write Remove_QS_Parameter(qs,"myparam1") & "<br>" Response.Write Remove_QS_Parameter(qs,"myparam2") & "<br>" Response.Write Remove_QS_Parameter(qs,"myparam3") & "<br>" %>
YOUR RESULTS;
?myparam2=02&myparam3=003 ?myparam1=1&myparam3=003 ?myparam1=1&myparam2=02
Sigh. I'd be happy to "fix" my code. Just tell me what's wrong with it. Otherwise, you probably are better off reposting, since I am obviously missing something. Good luck.
"scott" <sc***@sbailey.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... no, it is i who have missed something, i deeply apologize for temporary stupidity. the medication is affecting my brain more than i thought.
No problem. Please don't hesitate to post again if you have any other
questions. I look forward to helping if I am able.
Yours in respect and friendship,
Chris Hohmann This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Luklrc |
last post by:
Hi,
I'm having to create a querysting with javascript. My problem is that
javscript turns the "&" characher into "&" when it gets used as a
querystring in the url EG:
...
|
by: scott |
last post by:
Below, I'm trying to remove the querystring name& value of "catID=12".
I mananged to isolate the RESULTS part, but I need to be able to strip the
querystring name and it's value, no matter if the...
|
by: Jeremy |
last post by:
I'm trying to understand the following part of a QueryString value: What
does the %23 mean? I presume that the 'efefef' is a color (RGB) value. What
about the '&'. I thought the ampersand (&)...
|
by: DaveF |
last post by:
I am looping threw the querySting with:
foreach (string name in Request.QueryString)
I have a problem with a '&' being in one of the values. How do I deal with
this?
...
|
by: Mehdi |
last post by:
Hi,
I need to pass an URL via a hidden value as follow:
<input type="hidden" id="Test" runat="Server">
and on Page_Load I assign a value to this hidden input as follow:
Test.Value =...
|
by: Milsnips |
last post by:
hi there,
i have the following HTML code:
--------------------------
<asp:DropDownList id="hddList" runat="server">
<asp:ListItem Value="1">Item 1</asp:ListItem>
<asp:ListItem Value="2">Item...
|
by: |
last post by:
Hi all,
If I am reading this right, then the querystring parameters must be "&"
and not "&". However, IIS 6.0 and asp.net request.querystring fails to
capture the values if "&" is specified....
|
by: Elroyskimms |
last post by:
I have to encode an address which contains an ampersand (&) into a URL
with various querystring parameters. The following code works fine:
URLString = "www.myserver.com?AD1=" &...
|
by: Ixnay |
last post by:
Thanks in advance for any help you can give me on this.
I am trying to include the value from a request.querystring in the
DataNavigateUrlFormatString
I am able to include one of the values...
|
by: Tom |
last post by:
Trying to build a querystring using Attributes.Add:
return_ok.Attributes.Add("value",
"http://mydomain.com/finish.aspx?finish=324234" + @"&email=raerwe@fred.com"
+ @"&verify=32423dasdf3");
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |