Get email domain

A program that uses basic text manipulation skills is to get the domain from an email address. This could be used to build a spam filter. I have yet to find a programming language that could not do this.

Algorithm

  • Find the location of the @ symbol
  • Find the length of the entire string
  • Extract from 1 character after the @ symbol to the end of the string.

TouchDevelop

Code in TouchDevelop

App Inventor

Screen setup for App Inventor
Blocks for App Inventor

JavaScript

The following was done in LiveWeave.

JavaScript:

JavaScript to get e-mail domain
HTML:
HTML for page



Comments