The URL functions return parts of a specific URL, such as the host name used in the URL.
This table describes the URL (Uniform Resource Locator) functions that Transform supports.
| User Function | Return Data Type | Description |
|---|---|---|
| getURLAuthority(String url) | String | Returns the authority part of the URL as a single-assign string attribute. The authority part comprises an optional user-information part, a host name (e.g., domain name or IP address), and an optional port number. |
| getURLHost(String url) | String | Returns the host name in the URL as a single-assign string attribute. |
| getURLPath(String url) | String | Returns the path in the URL as a single-assign string attribute. The path begins with a single forward slash, not a double forward slash. Returns null if the URL does not contain a single forward slash. |
| getURLPort(String url) | Long | Returns the port number of the URL as a single-assign Long attribute. Returns -1 if the URL does not contain a port number. |
| getURLProtocol(String url) | String | Returns the protocol name of the URL as a single-assign string attribute. Protocol examples are http, https, and ftp. Returns null if the URL does not contain a valid protocol. |
| getURLQuery(String url) | String | Returns the query part of the URL as a single-assign string attribute. The query part is an optional part, separated by a question mark ("?"), that contains additional identification information that is not hierarchical in nature. Returns null if the URL does not contain a query part. |
| getURLRef(String url) | String | Returns the reference (ref) part of the URL as a single-assign string attribute. The reference part (also called a fragment) is indicated by a sharp-sign (#) followed by more characters. Returns null if the URL does not contain a reference part. |
| getURLUserInfo(String url) | String | Returns the user-information part of the URL as a single-assign string attribute. The user-information part is terminated with an at-sign (@). Returns null if the URL does not contain a user-information part. |
getURLAuthority('http://jjones:hello@www.example.com:1080/docs/resource1.html')
returns
jjones:hello@www.example.com:1080 as a single-assign
string attribute.
getURLHost('http://www.example.com:1080/docs/resource1.html')
returns
www.example.com as a single-assign string attribute.
getURLPath('http://www.example.com:1080/docs/resource1.html')
returns
/docs/resource1.html as a single-assign string
attribute.
getURLPort('http://www.example.com:1080/docs/resource1.html')
returns
1080 as a single-assign long attribute.
getURLProtocol('http://www.example.com:1080/docs/resource1.html')
returns
http as a single-assign string attribute.
getURLQuery('http://www.example.com:1080/ShowOrder.aspx?ID=10248')
returns
ID=10248 as a single-assign string attribute.
getURLRef('http://www.example.com:1080/docs/chapter1.html#introduction')
returns
introduction as a single-assign string attribute.
getURLUserInfo('http://jjones:hello@www.example.com:1080/docs/resource1.html')
returns
jjones:hello as a single-assign string attribute.