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 7754
"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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |