View source code Display the source code in std/uri.d from which this page was generated on github. 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. Page wiki View or edit the community-maintained wiki page associated with this page.

Function std.uri.emailLength

Does string s[] start with an email address?

Prototype

size_t emailLength(Char)(
  Char[] s
)
if (isSomeChar!Char);

Returns

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

References

RFC2822

Example

string s1 = "my.e-mail@www.example-domain.com with garbage added";
assert (emailLength(s1) == 32);
string s2 = "no email address here";
assert (emailLength(s2) == -1);

Authors

Walter Bright

License

Boost License 1.0.

Comments