On Mon, Jun 27, 2011 at 1:53 PM, <[email protected]> wrote: > ** Thanks! > > Sent from my BlackBerry® wireless device > ------------------------------ > *From: * mohamed salah <[email protected]> > *Sender: * [email protected] > *Date: *Mon, 27 Jun 2011 13:42:39 +0200 > *To: *<[email protected]> > *ReplyTo: * [email protected] > *Subject: *Re: Fast way for email, phone input validation > > > salam > there mohammad salah > validate your phone create method validate your email > > --------------------------------------------------------------- > // this method is email for example [email protected] > > public static boolean isEmail(final String value) { > boolean valid = true; > if (value != null) { > valid = value.matches(".+@.+\\.[a-z]+"); > > if (value.contains(" ")) { > valid = false; > } > } > > return valid; > > } > --------------------------------------------------------------- > > // this method is email is not empty > public static boolean isEmptyValue(final String value) { > boolean valid = true; > if (value == null) { > return valid = false; > } > if (value.trim().equals("")) { > return valid = false; > } > > return valid; > } > --------------------------------------------------------------- > // this method is email min lenght > public static boolean checkMinlength(final String value, final int > minLength) { > boolean valid = true; > if (value != null) { > if (value.length() < minLength) { > valid = false; > } > > } > > return valid; > > } > > --------------------------------------------------------------- > // this method is MaX length > > public static boolean checkMaXlength(final String value, final int > maxLength) { > boolean valid = true; > if (value != null) { > if (value.length() > maxLength) { > valid = false; > } > > } > > return valid; > > } > --------------------------------------------------------------- > > validate is Fone > --------------------------------------------------------------- > create varible > public static final String RGEX_PHONE_ONLY = > "^\\(?(\\d{3}-)\\)?(\\d{3}-)?(\\d{4})$"; > this varible validate to phone for example method > > --------------------------------------------------------------- > //this method is Phone for example 111-111-1111 is true. > 1111-111-1111 is not true > 1111-1111-1111 is not true > 111-111-111 is not true > and contune. > this method . > --------------------------------------------------------------- > public static boolean isPhone(String value) { > boolean valid = false; > valid = value.matches(RGEX_PHONE_ONLY); > if (valid) { > valid = true; > } > return valid; > } > --------------------------------------------------------------- > *Regard: Senior : Mohamed salah hasan > Mobile :+20106594094 > tel :+2024460320 > Mail:[email protected]* > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. >
-- ----------------------------------------- not at all *Regard: Mohamed salah hasan Mobile :+20106594094 tel :+2024460320* -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
