Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Johurt(ES.^, Edgar).
- Date: 23-02-2013.
- */
- stock IsCorrectMail(mail[])
- {
- new len = strlen(mail), bool:find[2], w;
- if(!(6 < len < 129)) return false;
- for(new l; l < len; l++)
- {
- if(mail[l] == '.') find[0] = true;
- if(mail[l] == '@')
- {
- if(find[1]) return false;
- find[1] = true;
- w = l;
- if(w > 64) return false;
- }
- if(!(mail[l] >= 'A' && mail[l] <= 'Z' || mail[l] >= 'a' && mail[l] <= 'z' || mail[l] >= '0' && mail[l] <= '9' || mail[l] == '.' || mail[l] == '-' || mail[l] == '_' || mail[l] == '@')) return false;
- }
- if(len - w > 65) return false;
- if(!find[0] || !find[1]) return false;
- return true;
- }
- /* Example */
- main()
- {
- print("\n\n\n");
- printf("Mail test@mail.com: %s", IsCorrectMail("test@mail.com") ? ("Correct") : ("Incorrect"));
- printf("Mail a@b.c: %s", IsCorrectMail("a@b.c") ? ("Correct") : ("Incorrect"));
- print("\n\n\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement