0

i have an application where users submit URL's. these urls may be anything, a few examples are here:

ftp://ftp.mysite.com
ftp.mysiste.com
mysite.com
mysite.de
ftp.mysite.it/somepath/somotherfolder
ftp://ftp.anysiste.com/
ftp://ftp.anysiste.org/somefolder/

i need to split these sites in the URL and the PATH. here is the result of the above:

ftp.mysite.com ---- /
ftp.mysiste.com ---- /
mysite.com ---- /
mysite.de ---- /
ftp.mysite.it ---- /somepath/somotherfolder
ftp.anysiste.com ---- /
ftp.anysiste.org ---- /somefolder/

is there a safe way to split these like this? or do i have to make it via search/split functions?

4

1 に答える 1

1

クラスを使用System.Uriます。

Dim uri As New Uri("ftp://ftp.anysiste.org/somefolder/")
uri.AbsolutePath '/somefolder/
uri.Host         'ftp.anysiste.org
uri.Scheme       'ftp
于 2013-07-07T13:13:43.850 に答える