从网址获取最后一个值 [英] Get the Last value from Url

查看:60
本文介绍了从网址获取最后一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
即时通讯从url
检索最后一个值 例如:
const string str ="http://www.codeproject.com/Questions/ask.aspx"
这是恒定的
我的应用程序自动将所有字符串或数字添加为
http://www.codeproject.com/Questions/ask.aspx sadfsf_sdf
http://www.codeproject.com/Questions/ask.aspx skdfwer234
现在我想从url中获取值,添加的新值是什么
结果是= sadfst_sdf
result2是= skdfwer234
像这样

不知道如果有人帮助我,我该怎么办
非常适合
谢谢你.

Hi all,
im retrieve last value from url
example:
const string str="http://www.codeproject.com/Questions/ask.aspx"
this is constant
im my application automaticall added string or number like
http://www.codeproject.com/Questions/ask.aspxsadfsf_sdf
http://www.codeproject.com/Questions/ask.aspxskdfwer234
Now i want to get the value from url what is the new value added
result is=sadfst_sdf
result2 is=skdfwer234
like this

don''t know how can i get like that if any one help me out
greatly appriciate
Thank U.

推荐答案

测试一下.

Test this one.

String test = "http://www.codeproject.com/Questions/ask.aspxsadfsf_sdf";
            test = test.Substring(test.IndexOf("aspx"));


字符串strs = last.Substring(last.LastIndexOf("http://test.com/ws/test/v10")+ 28);
Console.Write(strs.ToString());
这也很好用.
string strs = last.Substring(last.LastIndexOf("http://test.com/ws/test/v10") + 28);
Console.Write(strs.ToString());
this is also working fine.


这篇关于从网址获取最后一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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