D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Sun Oct 11 21:34:28 2009

# std.uri

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.

See Also:
RFC 3986
Wikipedia

License:
Boost License 1.0.

Authors:
Walter Bright

Copyright Digital Mars 2000 - 2009. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at ) http:
//www.boost.org/LICENSE_1_0.txt

string decode(string encodedURI);
  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.

string decodeComponent(string encodedURIComponent);
  Decodes the URI string encodedURI into a UTF-8 string and returns it. All escape sequences are decoded.

string encode(string uri);
  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.

string encodeComponent(string uriComponent);
  Encodes the UTF-8 string uriComponent into a URI and returns that URI. Any character not a letter, digit, or one of -.!~*'() is escaped.

size_t uriLength(string s);
  Does string s[] start with a URL?

  Returns:
  -1 it does not len it does, and s[0..len] is the slice of s[] that is that URL

size_t emailLength(string s);
  Does string s[] start with an email address?

  Returns:
  -1 it does not len it does, and s[0..i] is the slice of s[] that is that email address

  References:
  RFC2822

Copyright Digital Mars 2000 - 2009. | Page generated by Ddoc.