如何从C#中的url获取Protocal [英] how to get Protocal from url in C#

查看:91
本文介绍了如何从C#中的url获取Protocal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,





i希望从url(或字符串)获取协议



喜欢输入输出



http://goole.com :: http://

rtmp:// xxx .com / live :: rtmp://

rtsp://xyx.com/sdp :: rtsp://

mms:// fsdfsdf / asdasd :: mms://







如果我有http://xyx.com而不是输出应该是http://







任何帮助将不胜感激



Lak

hello,


i want to get protocol from url (or string)

like input output

http://goole.com :: http://
rtmp://xxx.com/live :: rtmp://
rtsp://xyx.com/sdp :: rtsp://
mms://fsdfsdf/asdasd :: mms://



if i have http://xyx.com than output should be http://



any help will be appreciated

Lak

推荐答案

这不是一个协议。这称为 URI方案 http://en.wikipedia.org/wiki/URI_scheme [ ^ ]。



这是你如何得到它: http://msdn.microsoft.com/en-us/library/system.uri.scheme%28v=vs.110%29.aspx [ ^ ]。



就是这样。



-SA
This is not quite a protocol. This is called URI scheme: http://en.wikipedia.org/wiki/URI_scheme[^].

This is how you can get it: http://msdn.microsoft.com/en-us/library/system.uri.scheme%28v=vs.110%29.aspx[^].

That's all.

—SA


这篇关于如何从C#中的url获取Protocal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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