View source code
Display the source code in std/uri.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.uri.uriLength

Does string s[] start with a URL?

ptrdiff_t uriLength(Char) (
  scope const(Char)[] s
)
if (isSomeChar!Char);

Returns

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

Example

string 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);

Authors

Walter Bright

License

Boost License 1.0.