UrlProperty

=UrlProperty(
    string url, 
    string property, 
    [string queryParam],
    [string queryValue]
) : string

Returns property of an url.

In the following examples this url is used as reference A1:
http://niels@sub.domain.co.uk:1090/path/to/file.aspx?a=b&c=d=e#fragment

Absolute

Returns the absolute url. If the url is misspelled, i.e. htp:/mydomain.com this is corrected.

=UrlProperty("domain.com","absolute") => "http://domain.com"
=UrlProperty("htp:/mydomain.com","absolute") => "http://domain.com" 
=UrlProperty(A1,"absolute") => "http://niels@sub.domain.co.uk:1090/path/to/file.aspx?a=b&c=d=e#fragment"

Host

Returns the host of the url.

=UrlProperty(A1,"host") => "sub.domain.co.uk"

Domain

Returns the domain of the url. UrlProperty is aware that some top level domain have second level domains (such as co.uk).

=UrlProperty(A1,"domain") => "domain.co.uk
=UrlProperty("sub.domain.com","domain") => "domain.com"

Tld

Returns the top level domain of the url.

=UrlProperty(A1,"tld") => "uk"

Registrar

Returns the second level domain if applicable together with top level domain.

=UrlProperty(A1,"registrar") => "co.uk"
=UrlProperty("mydomain.com","registrar") => "com"

Fragment

Returns the fragment (location within a resource) of the url.

=UrlProperty(A1,"fragment") => "fragment"

User

Returns the user information of the url.

=UrlProperty(A1,"user") => "niels"

Scheme

Returns the scheme of the url.

=UrlProperty(A1,"scheme") => "http"

Port

Returns the port of the url.

=UrlProperty(A1,"port") => "1090"

Path

Returns the path referenced in the url if applicable.

=UrlProperty(A1,"path") => "/path/to/"

File

Returns the file name referenced in the url if applicable.

=UrlProperty(A1,"file") => "file.aspx"

Extension

Return the extension of the file referenced in the url if applicable.

=UrlProperty(A1,"extension") => "aspx"

Left

Returns the left part for the url.

UrlProperty("http://nielsbosma.se/foo?query=value";"left")
=>http://nielsbosma.se/foo

Name

Returns the name part of the domain.

=UrlProperty("http://www.nielsbosma.co.uk","name") 
=>"nielsbosma"

Query

If no queryParam specified the entire querystring is returned. Otherwise returns the value of specified query parameter.

=UrlProperty(A1,"query","a") => "b"
=UrlProperty(A1,"query","c") => "d"
=UrlProperty(A1,"query","x") => ""

Adding a fourth parameter queryValue with property ´query´ allows you to set the queryValue of a queryParam in an url.

=UrlProperty("http://domain.com/Default.aspx?a=b&foo=x","query","foo","bar")
=> "http://domain.com/Default.aspx?a=b&foo=bar"

Depth

Returns the "depth" of the path in the url.

=UrlProperty("http://seotoolsforexcel.com","depth") => 0 
=UrlProperty("http://seotoolsforexcel.com/","depth") => 0 
=UrlProperty("http://seotoolsforexcel.com/foo","depth") => 0
=UrlProperty("http://seotoolsforexcel.com/foo/","depth") => 1
=UrlProperty("http://seotoolsforexcel.com/foo/bar","depth") => 1     
=UrlProperty("http://seotoolsforexcel.com/foo/bar/","depth") => 2  

Comments

comments powered by Disqus