Name

getPort — Return the port extracted from a URL

Usage

URL.getPort(url)

url : String

Description

Returns the port number extracted from url. Both relative and absolute URLs are supported. Returns the empty string if url doesn’t specify a port.

Returns invalid if url can’t be converted to a string or can’t be parsed as a URL.

Examples

URL.getPort("http://www.inhand.net:80/")

returns string "80"

URL.getPort("http://www.inhand.net/")

returns string ""

URL.getPort("http://www.inhand.net:xxx/")

returns invalid

URL.getPort(invalid)

returns invalid

Get Learning WML, and WMLScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.