Course Content
Java Extended
Java Extended
Challenge: Email Validation
Swipe to show code editor
Your task is to 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
validateEmail
method, find the index of the@
symbol in theemail
. - In the
validateEmail
method, find the index of the first 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
extractDomainFromEmail
method, find the index of the@
symbol in the ``email`. - Extract and return the substring starting from the character immediately after
@
in theextractDomainFromEmail
method. - In the
main
method, trim any leading and trailing spaces from the email string.
Thanks for your feedback!
Challenge: Email Validation
Swipe to show code editor
Your task is to 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
validateEmail
method, find the index of the@
symbol in theemail
. - In the
validateEmail
method, find the index of the first 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
extractDomainFromEmail
method, find the index of the@
symbol in the ``email`. - Extract and return the substring starting from the character immediately after
@
in theextractDomainFromEmail
method. - In the
main
method, trim any leading and trailing spaces from the email string.
Thanks for your feedback!
Challenge: Email Validation
Swipe to show code editor
Your task is to 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
validateEmail
method, find the index of the@
symbol in theemail
. - In the
validateEmail
method, find the index of the first 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
extractDomainFromEmail
method, find the index of the@
symbol in the ``email`. - Extract and return the substring starting from the character immediately after
@
in theextractDomainFromEmail
method. - In the
main
method, trim any leading and trailing spaces from the email string.
Thanks for your feedback!
Swipe to show code editor
Your task is to 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
validateEmail
method, find the index of the@
symbol in theemail
. - In the
validateEmail
method, find the index of the first 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
extractDomainFromEmail
method, find the index of the@
symbol in the ``email`. - Extract and return the substring starting from the character immediately after
@
in theextractDomainFromEmail
method. - In the
main
method, trim any leading and trailing spaces from the email string.