Encode and decode Uniform Resource Identifiers (URIs). URIs are used in internet transfer protocols. Valid URI characters consist of letters, digits, and the characters ;/?:@&=+$,-.!~*'() Reserved URI characters are ;/?:@&=+$, Escape sequences consist of % followed by two hex digits.
This Exception is thrown if something goes wrong when encoding or decoding a URI.
Decodes the URI string encodedURI
into a UTF-8 string and returns it. Escape sequences that resolve to reserved URI characters are not replaced. Escape sequences that resolve to the '#' character are not replaced.
Decodes the URI string encodedURI into a UTF-8 string and returns it. All escape sequences are decoded.
Encodes the UTF-8 string uri
into a URI and returns that URI. Any character not a valid URI character is escaped. The '#' character is not escaped.
Encodes the UTF-8 string uriComponent
into a URI and returns that URI. Any character not a letter, digit, or one of -.!~*'() is escaped.
Does string s
[] start with a URL?
s
[0 .. len] is the slice of s
[] that is that URLstring s1 = "http://www.digitalmars.com/~fred/fredsRX.html#foo end!"; writeln(uriLength(s1)); // 49 string s2 = "no uri here"; writeln(uriLength(s2)); // -1 assert(uriLength("issue 14924") < 0);
Does string s
[] start with an email address?
s
[0 .. i] is the slice of s
[] that is that email address string s1 = "[email protected] with garbage added"; writeln(emailLength(s1)); // 32 string s2 = "no email address here"; writeln(emailLength(s2)); // -1 assert(emailLength("issue 14924") < 0);
© 1999–2017 The D Language Foundation
Licensed under the Boost License 1.0.
https://dlang.org/phobos/std_uri.html