在=号之前和之后=号之前替换查找值
你好
我有一个网址,例如(www.example.com/jsk/product_detail.aspx?icode=KUT101)
在这种方法中,如何使用我在= sign之前和after = sign之后找出字符串的索引或子字符串方法
hello
I have a url for example( www.example.com/jsk/product_detail.aspx?icode=KUT101")
In this how to use index of or substring method that I find out string before = sign and after = sign
Google是否在您的位置坏了? MSDN有一个很好的示例 [
Is Google broken at your place? MSDN has a nice example [^]for this.
string text = "www.example.com/jsk/product_detail.aspx?icode=KUT101";
string[] words = text.Split('=');
string beforeEqualSign = words[0];
string afterEqualSign = words[1];
顺便说一句,我想您需要阅读查询字符串.详细了解 http://msdn.microsoft.com/zh-CN/library/system.web.httprequest.querystring.aspx .
Btw, I guess that you need to read the query string. Read more about it http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx.
如果您需要在查询字符串中查找值,则可以始终使用:
If you need to find the value in the query string, you can always use:
string strCode = Request.QueryString["icode"];
strCode
将包含值KUT101
要获取所提供的URL中的所有值,可以使用Split方法.例如,请参见下面的链接:
http://forums.asp.net/t/1250996.aspx/1 [ ^ ]
strCode
will contain the value KUT101
For getting all the values in the URL provided, you can use Split method. See below link for example:
http://forums.asp.net/t/1250996.aspx/1[^]