Skip to content

Issue 15750 - remove substr from std.net.isemail#5585

Merged
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:remove-substr
Jul 9, 2017
Merged

Issue 15750 - remove substr from std.net.isemail#5585
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:remove-substr

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Jul 9, 2017

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Auto-close Bugzilla Description
15750 net/isemail uses lots of redundant helper methods

returnStatus ~= EmailStatusCode.rfc5322IpV6ColonStart;

else if (ipV6.substr(-1) == Token.colon && ipV6.substr(-2, -1) != Token.colon)
else if (ipV6[$ - 1 .. $] == Token.colon && ipV6[$ - 2 .. $ - 1] != Token.colon)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert("abcdef".substr(-1) == "f");
assert("abcdef".substr(-2, -1) == "e");

}

if (ipV6.substr(0, 1) == Token.colon && ipV6.substr(1, 1) != Token.colon)
if (ipV6[0 .. 1] == Token.colon && ipV6[1 .. 2] != Token.colon)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In substr end = start + end, or as tests:

assert("abcdef".substr(0, 1) == "a");
assert("abcdef".substr(1, 1) == "b");

@wilzbach wilzbach added the Review:Trivial typos, formatting, comments label Jul 9, 2017
@dlang-bot dlang-bot merged commit e9ff980 into dlang:master Jul 9, 2017
@wilzbach wilzbach deleted the remove-substr branch December 11, 2017 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge:auto-merge Review:Trivial typos, formatting, comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants