Strings.isUrl()

Syntax

function isUrl(url: string): boolean

Checks if a string is a valid URL.

Parameters
url

The string to check.

Example

import { Strings } from 'potence';

Strings.isUrl('https://www.google.com');  // -> true
Strings.isUrl('http:google.com');         // -> false

Remarks

URL testing, like e-mail address testing, is a notoriously complicated topic due to the vast number of different valid URL variants available. If you discover a valid URL string for which this function erroneously returns false, please don’t hesitate to open a new issue on our public github.