Skip to content

929. Unique Email Addresses#26

Open
Apo-Matchbox wants to merge 1 commit intomainfrom
929.-Unique-Email-Addresses
Open

929. Unique Email Addresses#26
Apo-Matchbox wants to merge 1 commit intomainfrom
929.-Unique-Email-Addresses

Conversation

@Apo-Matchbox
Copy link
Copy Markdown
Owner

}

private:
std::string NormalizeEmail(const std::string& email) const {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Normalize という単語は、項目内部での冗長性の削減を表すようです。一方、 Canonicalize という単語は、項目間の比較のために変化させることを表すようです。今回の場合は Canonicalize のほうを使うのが適していると思います。

std::string NormalizeEmail(const std::string& email) const {
std::size_t at_position = email.find('@');
std::string local = email.substr(0, at_position);
std::string domain = email.substr(at_position);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ドメインパートは @ の次の文字から始まるため、変数名と格納される値がややずれているように思いました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants