Created
January 10, 2018 19:43
-
-
Save Lord-Haji/8be461b27a6865848b7c5d4a9875e73e to your computer and use it in GitHub Desktop.
[JAVA][BETA] Shows random Email ID combinations with using user's Name / DOB <3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class EmailID_Generator | |
{ | |
String domainList[] = {"@outlook.com", "@gmail.com", "@icloud.com", "@rediffmail.com", "@hotmail.com", "@live.in", "@yahoo.co.in"}; | |
char valid_chars[] = {' ', '.', '!', '#', '$', '%', '&', '*', | |
'+', '-', '/', '=', '?', '^', '_', '`', '|', '~',}; | |
void main() | |
{ | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Enter name:"); | |
String name = sc.nextLine().toLowerCase().trim(); | |
System.out.println("Do you want to reflect the DOB in your generated Email IDs?(Y/N):-"); | |
char c = sc.next().charAt(0); | |
c = Character.toLowerCase(c); | |
switch (c) | |
{ | |
case 'y': | |
System.out.println("Enter DOB(DD/MM/YY):-"); | |
String DOB = sc.next().trim(); | |
emailid_gen_dob(name, DOB); | |
break; | |
case 'n': | |
emailid_gen(name); | |
break; | |
default: | |
System.err.println("Invalid Input"); | |
System.exit(0); | |
} | |
} | |
void emailid_gen(String name) | |
{ | |
int counter = 0; | |
String parts[] = name.split("\\s"); // Considering a 2 word name. TODO: UNIVERSAL | |
for (String domain : domainList) | |
{ | |
for (char c : valid_chars) | |
{ | |
System.out.println(parts[0] + (Character.isWhitespace(c) ? "" : c) + parts[1] + domain); | |
System.out.println(parts[1] + (Character.isWhitespace(c) ? "" : c) + parts[0] + domain); | |
counter += 2; | |
} | |
} | |
System.out.println("Total Generated Email IDs:- " + counter); | |
} | |
void emailid_gen_dob(String name, String DOB) | |
{ | |
int counter = 0; | |
String parts[] = name.split("\\s"); // Considering a 2 word name. TODO: UNIVERSAL | |
String date_data[] = DOB.split("/"); | |
for (String domain : domainList) | |
{ | |
for (char c : valid_chars) | |
{ | |
System.out.println(parts[0] + (Character.isWhitespace(c) ? "" : c) + parts[1] + domain); | |
System.out.println(parts[0] + date_data[0] + (Character.isWhitespace(c) ? "" : c) + parts[1] + domain); | |
System.out.println(parts[0] + (Character.isWhitespace(c) ? "" : c) + parts[1] + date_data[2] + domain); | |
System.out.println(parts[0] + (Character.isWhitespace(c) ? "" : c) + parts[1] + date_data[0] + date_data[1] + date_data[2] + domain); | |
System.out.println(parts[0] + date_data[1] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[1] + domain); | |
System.out.println(parts[0] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[1] + domain); | |
System.out.println(parts[0] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[1] + date_data[0] + date_data[1] + domain); | |
System.out.println(parts[1] + (Character.isWhitespace(c) ? "" : c) + parts[0] + domain); | |
System.out.println(parts[1] + date_data[0] + (Character.isWhitespace(c) ? "" : c) + parts[0] + domain); | |
System.out.println(parts[1] + (Character.isWhitespace(c) ? "" : c) + parts[0] + date_data[2] + domain); | |
System.out.println(parts[1] + (Character.isWhitespace(c) ? "" : c) + parts[0] + date_data[0] + date_data[1] + date_data[2] + domain); | |
System.out.println(parts[1] + date_data[1] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[0] + domain); | |
System.out.println(parts[1] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[0] + domain); | |
System.out.println(parts[1] + date_data[2] + (Character.isWhitespace(c) ? "" : c) + parts[0] + date_data[0] + date_data[1] + domain); | |
counter += 14; | |
} | |
} | |
System.out.println("Total Generated Email IDs:- " + counter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment