如果这是正则表达式或拆分方法,则不确定 [英] Not Sure If This Is Regex Or Split Method

查看:98
本文介绍了如果这是正则表达式或拆分方法,则不确定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Visual Basic 2008的新手,我想知道如何转换:

I'm new to using visual basic 2008 and I was wondering how I could convert:

http://www.google.com/url?sa=t&rct=j&q=%22bodybuilding%22%20%22leave%20comment%22%20%22powered%20by%20wordpress%22&source=web&cd=1&ved=0CFQQFjAA&url=http%3A%2F%2Fmusclemassworkouts.net%2Ftag%2Fbodybuilding-supplement%2Fpage%2F4%2F&ei=57PcT42DMZSY8gTbn-HECg&usg=AFQjCNGuBXxjLxqLrfitKRIrthw8FCkCNQ

TO

http://musclemassworkouts.net/tag/bodybuilding-supplement/page/4/

我看到google已重定向,我想摆脱多余的东西,只保留真实链接.我在google搜索引擎中输入了一个查询,我发现有这些真的很长的google重定向链接.我想发送真实的链接(减 扩展的重定向链接),通过单击button1进入textbox1.text.

I see that google has redirect and I would like to get rid of the extra and only leave the real link. I type a query into the google search engine and I see that there are these really long google redirect links. I would like to send the real links (minus the extended redirect links) into a textbox1.text via a click of a button1.

我的问题是,使用Regex或String Splitt方法这样做会更好吗?无论哪种方式,有人都可以提供示例代码或代码段帮助吗?

My question is, is this better to do using Regex or a String Splitt method? Either way, could someone help with an example code or snippet?

我希望得到一个例子...

I would appreciate an example...

推荐答案

可能都不是... = P

Probably neither... =P

使用IndexOf()获取起始索引,该起始索引位于"url ="结束索引位于第一个&"在起始索引或行尾之后.

Use IndexOf() to get the start index at "url=" and the end index at the first "&" after the start index, or the end of line.

现在,您可以使用SubString()仅获取URL,然后使用System.Net.WebUtility.HttpDecode()替换编码令牌.

Now you can use SubString() to get just the URL and then System.Net.WebUtility.HttpDecode() to replace the encoding tokens.


这篇关于如果这是正则表达式或拆分方法,则不确定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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