Check Email Address Validity In PowerBuilder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
//==================================================================== // Function: f_isvalidemail() //-------------------------------------------------------------------- // Description: Check Invalid Email //-------------------------------------------------------------------- // Arguments: // value string as_email : Email Address //-------------------------------------------------------------------- // Returns: boolean True Valid Email, False InValid Email //==================================================================== Boolean lb_return = True String ls_domaintype String ls_domainname Integer i Constant String ls_invalidchars = "!#$%^&*()=+{}[]|\;:'/?>,< " // if there double quote character If Pos(as_email, Char(34)) > 0 Then lb_return = False If Left(as_email,1) = "." Or Right(as_email,1) = "." Then lb_return = False If lb_return Then // check for invalid characters. If Len(as_email) > Len(ls_invalidchars) Then For i = 1 To Len(ls_invalidchars) If Pos(as_email, Mid(ls_invalidchars, i, 1)) > 0 Then lb_return = False Exit End If Next Else For i = 1 To Len(as_email) If Pos(ls_invalidchars, Mid(as_email, i, 1)) > 0 Then lb_return = False Exit End If Next End If If lb_return Then //check for an @ symbol If Pos(as_email, "@") > 1 Then //lb_return = f_if(Len(Left(as_email, Pos(as_email, "@", 1) - 1)) > 0,True,False) If Len(Left(as_email, Pos(as_email, "@", 1) - 1)) > 0 Then lb_return = True Else lb_return = False End If Else lb_return = False End If If lb_return Then //check to see if there are too many @'s as_email = Right(as_email, Len(as_email) - Pos(as_email, "@")) //lb_return = f_if(Pos(as_email, "@") > 0, False, True) If Pos(as_email, "@") > 0 Then lb_return = False Else lb_return = True End If If lb_return Then ls_domaintype = Right(as_email, Len(as_email) - Pos(as_email, ".")) //lb_return = f_if(Len(ls_domaintype) > 0 And Pos(as_email, ".") < Len(as_email), True, False) If Len(ls_domaintype) > 0 And Pos(as_email, ".") < Len(as_email) Then lb_return = True Else lb_return = False End If If lb_return Then as_email = Left(as_email, Len(as_email) - Len(ls_domaintype) - 1) Do Until Pos(as_email, ".") <= 1 If Len(as_email) >= Pos(as_email, ".") Then as_email = Left(as_email, Len(as_email) - (Pos(as_email, ".") - 1)) Else lb_return = False Exit End If Loop If lb_return Then If as_email = "." Or Len(as_email) = 0 Then lb_return = False End If End If End If End If End If End If Return lb_return |
Find Projects On Github click here
Attachments Objects:
Good Luck!
Subscribe
Login
0 Comments
Oldest