Url

Overview

Represents a Uniform Resource Locator, a pointer to a resource on the World Wide Web.

Use case

You can use URL class to specify some resource and get access to individual part of an url, for example:

var Url := new Sugar.Url("http://example.com/index.html");
writeLn(Url.Host);
writeLn(Url.Path);
writeLn(Url.Scheme);

Output:

example.com
/index.html
http

Location

  • Reference: Sugar
  • Namespace: Sugar

 

constructor

Creates a new instance of the class with specified parameter.

 

constructor(UriString: String)

 

Url(String UriString)

 

init(_ UriString: String)

 

Url(String UriString)

 

Sub New(UriString As String)

Parameters:

  • UriString: String representation of the url.

Fragment

Gets the escaped url fragment.

 

property Fragment: String read;

 

String Fragment { get; }

 

var Fragment: String { get{} }

 

String Fragment { __get; }

 

ReadOnly Property Fragment() As String

GetParentUrl  mapped

 

method GetParentUrl: Url

 

Url GetParentUrl()

 

func GetParentUrl() -> Url

 

Url GetParentUrl()

 

Function GetParentUrl() As Url

GetSubUrl  mapped

 

method GetSubUrl(aName: String): Url

 

Url GetSubUrl(String aName)

 

func GetSubUrl(_ aName: String) -> Url

 

Url GetSubUrl(String aName)

 

Function GetSubUrl(aName As String) As Url

Parameters:

  • aName:

Host

Gets the host component.

 

property Host: String read;

 

String Host { get; }

 

var Host: String { get{} }

 

String Host { __get; }

 

ReadOnly Property Host() As String

Path

Gets the absolute path of the url.

 

property Path: String read;

 

String Path { get; }

 

var Path: String { get{} }

 

String Path { __get; }

 

ReadOnly Property Path() As String

Port

Gets the port numbe or -1 in case it wasn't specified.

 

property Port: Int32 read;

 

Int32 Port { get; }

 

var Port: Int32 { get{} }

 

Int32 Port { __get; }

 

ReadOnly Property Port() As Int32

QueryString

Gets any query information.

 

property QueryString: String read;

 

String QueryString { get; }

 

var QueryString: String { get{} }

 

String QueryString { __get; }

 

ReadOnly Property QueryString() As String

Scheme

Gets the scheme name.

 

property Scheme: String read;

 

String Scheme { get; }

 

var Scheme: String { get{} }

 

String Scheme { __get; }

 

ReadOnly Property Scheme() As String

UrlEncodeString

 

class method UrlEncodeString(aString: String): String

 

static String UrlEncodeString(String aString)

 

static func UrlEncodeString(_ aString: String) -> String

 

static String UrlEncodeString(String aString)

 

Shared Function UrlEncodeString(aString As String) As String

Parameters:

  • aString:

UserInfo

Gets the user name, password, or other user-specific information.

 

property UserInfo: String read;

 

String UserInfo { get; }

 

var UserInfo: String { get{} }

 

String UserInfo { __get; }

 

ReadOnly Property UserInfo() As String

 

Fragment

Gets the escaped url fragment.

 

property Fragment: String read;

 

String Fragment { get; }

 

var Fragment: String { get{} }

 

String Fragment { __get; }

 

ReadOnly Property Fragment() As String

Host

Gets the host component.

 

property Host: String read;

 

String Host { get; }

 

var Host: String { get{} }

 

String Host { __get; }

 

ReadOnly Property Host() As String

Path

Gets the absolute path of the url.

 

property Path: String read;

 

String Path { get; }

 

var Path: String { get{} }

 

String Path { __get; }

 

ReadOnly Property Path() As String

Port

Gets the port numbe or -1 in case it wasn't specified.

 

property Port: Int32 read;

 

Int32 Port { get; }

 

var Port: Int32 { get{} }

 

Int32 Port { __get; }

 

ReadOnly Property Port() As Int32

QueryString

Gets any query information.

 

property QueryString: String read;

 

String QueryString { get; }

 

var QueryString: String { get{} }

 

String QueryString { __get; }

 

ReadOnly Property QueryString() As String

Scheme

Gets the scheme name.

 

property Scheme: String read;

 

String Scheme { get; }

 

var Scheme: String { get{} }

 

String Scheme { __get; }

 

ReadOnly Property Scheme() As String

UserInfo

Gets the user name, password, or other user-specific information.

 

property UserInfo: String read;

 

String UserInfo { get; }

 

var UserInfo: String { get{} }

 

String UserInfo { __get; }

 

ReadOnly Property UserInfo() As String

 

UrlEncodeString

 

class method UrlEncodeString(aString: String): String

 

static String UrlEncodeString(String aString)

 

static func UrlEncodeString(_ aString: String) -> String

 

static String UrlEncodeString(String aString)

 

Shared Function UrlEncodeString(aString As String) As String

Parameters:

  • aString:

 

constructor

Creates a new instance of the class with specified parameter.

 

constructor(UriString: String)

 

Url(String UriString)

 

init(_ UriString: String)

 

Url(String UriString)

 

Sub New(UriString As String)

Parameters:

  • UriString: String representation of the url.

GetParentUrl  mapped

 

method GetParentUrl: Url

 

Url GetParentUrl()

 

func GetParentUrl() -> Url

 

Url GetParentUrl()

 

Function GetParentUrl() As Url

GetSubUrl  mapped

 

method GetSubUrl(aName: String): Url

 

Url GetSubUrl(String aName)

 

func GetSubUrl(_ aName: String) -> Url

 

Url GetSubUrl(String aName)

 

Function GetSubUrl(aName As String) As Url

Parameters:

  • aName: