ChangeExtension(url, newExtension) : Url?

Returns new URL with new file extension.

ChangeExtension Parameters

url : Url

newExtension : String
Empty to remove file extension.

ChangeExtension Examples

var ok = Url('res:///internal/file.txt').ChangeExtension('csv') == Url('res:///internal/file.csv');
var ok = Url('res:///internal/file.txt').ChangeExtension('') == Url('res:///internal/file');

Url(url, relativePath?, params?) : Url?

Parses URL string to a URL object and optionally adds relative path and parameters.

Url Parameters

url : String
Base URL string to parse.

relativePath? : String?
Optional relative path to add to the base URL.

params? : Dict?
Additional URL query parameters.

Url Examples

var ok = Url('https://google.com', 'search', { q='test' }).Url == 'https://google.com/search?q=test';

UrlEscape(urlPart, isUrl?) : String?

Escapes URL part.

UrlEscape Parameters

urlPart : String?

isUrl? : Boolean
True to indicate that urlPart is URL itself (i.e. no escape for ‘/’, ‘=’ and ‘&’).

UrlEscape Examples

var ok = UrlEscape('a=b/c&d') == 'a%3Db%2Fc%26d';
var ok = UrlEscape('https://google.com/search?q=a b c&x=1', true) == 'https://google.com/search?q=a%20b%20c&x=1';

Leave a Comment

Your email address will not be published. Required fields are marked *