在=号之前和之后=号之前替换查找值 [英] substing find value before = sign and after = sign

查看:83
本文介绍了在=号之前和之后=号之前替换查找值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我有一个网址,例如(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[^]


这篇关于在=号之前和之后=号之前替换查找值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆