url.port
This function returns the port part of the URL, without the leading colon. If the URL does not contain a valid numeric port, it returns an empty string.
Syntax
url.port(rawURLString)
Arguments
|
Argument |
Type |
Description |
|---|---|---|
|
rawURLString |
string |
Raw URL string |
Returns
|
Type |
Description |
|---|---|
|
string |
The port part of the URL |
Examples
The function url.port("https://example.com:8080/root-path/sub-path?query=example+query+%2F+question#fragment") returns "8080".