セクション 3. 章 7
single
Challenge: Email Validation
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
Implement email validation by trimming any leading and trailing spaces from the string. Then, check the email's validity based on three conditions: there must be characters before the @ symbol, there must be characters after the @, and the domain after the @ must contain a dot. If the email is valid, extract and display the domain (the part after the @ symbol, excluding the symbol itself).
- In the
validateEmailmethod, find the index of the@symbol in theemail. - In the
validateEmailmethod, find the index of the last dot (.) symbol in theemail. - Check that the
@index is greater than0, and the dot index is greater than the@index and less than the length of the email minus 1. - In the
extractDomainFromEmailmethod, find the index of the@symbol in theemail. - Extract and return the substring starting from the character immediately after
@in theextractDomainFromEmailmethod. - In the
mainmethod, trim any leading and trailing spaces from the email string.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 3. 章 7
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください