Java Email¼òµ¥ÑéÖ¤
ƽʱµÄ¿ª·¢µ±ÖУ¬Í¨³£ÎÒÃÇÐèÒªÑéÖ¤EmailµØÖ·µÄºÏ·¨ÐÔ£¬Ê×ÏÈÒªÔÚÑéÖ¤´ËµØÖ·ÊÇ·ñ·ûºÏ¹æ·¶£¬Èô·ûºÏ¹æ·¶£¬ÔÙ·¢ÓʼþÒÔÈ·Èϴ˵ØÖ·ÊÇ·ñ´æÔÚ¡£
Ô´ÂëÈçÏ£º
public static boolean validateEmail(String email){
//Pattern pattern = Pattern.compile("[0-9a-zA-Z]*.[0-9a-zA-Z]*@[a-zA-Z]*.[a-zA-Z]*", Pattern.LITERAL);
if(email == null){
return false;
}
//ÑéÖ¤¿ªÊ¼
//²»ÄÜÓÐÁ¬ÐøµÄ.
if(email.indexOf("..") != -1){
return false;
}
//±ØÐë´øÓÐ@
int atCharacter = email.indexOf("@");
if (atCharacter == -1) {
return false;
}
//×îºóÒ»¸ö.±ØÐëÔÚ@Ö®ºó,ÇÒ²»ÄÜÁ¬Ðø³öÏÖ
if(atCharacter > email.lastIndexOf('.') || atCharacter+1 == email.lastIndexOf('.')){
return false;
}
//²»ÄÜÒÔ.,@½áÊøºÍ¿ªÊ¼
if (email.endsWith(".") || email.endsWith("@") || email.startsWith(".") || email.startsWith("@")) {
return false;
}
return true;
}
Èç¹ûÒÔÉ϶¼Í¨¹ýÁË£¬ÎÒÃǾÍÐèÒª·¢ÓʼþÀ´È·ÈϸÃÓÊÏäÕʺŻò³ÆµØÖ·ÊÇ·ñ´æÔÚÁË¡£
Ïà¹ØÎĵµ£º
Java Learning Path £¨Ò»£©¡¢¹¤¾ßƪ
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Íâ ......
Èô·¾¶Öдø¿Õ¸ñ£¬Ôò
1. uri.getpath();·µ»ØµÄ·¾¶ÖеĿոñÈÔÒÔ“¿Õ¸ñ”µÄÐÎʽ³öÏÖ£¬Èç/F:/MyEclipse Workspace/project/bin/...
³ý´ËÖ®Í⣬URL·µ»ØµÄÒ»Çз¾¶ÖеĿոñ¶¼ÒÔ“%20”µÄÐÎʽ³öÏÖ£¬uri.toString()Ò²ÒÔ“%20”µÄÐÎʽ³öÏÖ¡£
2. new File(String filePath);½ÓÊÜÕýÈ·URI¸ñʽµÄ²ÎÊýº ......
Õâ¸öÔÔòºÜ¼òµ¥£¬¾ÍÊÇʹÓÃ˽Óй¹Ô캯Êý·ÀÖ¹À౻ʵÀý»¯¡£ ÓÐʱ£¬ÎÒÃÇ»áдһЩ¹¤¾ßÀ࣬Èçjava.lang.Math »òÊÇ java.util.Arrays, ÕâЩÀàÖж¼ÊǾ²Ì¬º¯Êý£¬ÔÚÉè¼ÆµÄʱºò£¬ÕâЩÀಢ²»ÊÇÓÃÀ´±»ÊµÀý»¯µÄ¡£Õâ¸öʱºò£¬¾ÍºÜÓбØÒª°Ñ¹¹Ô캯Êý˽Óл¯¡£ public class UtilityClass {
private UtilityClass() {
throw ne ......
Java ±ê×¼ÈÕÖ¾¹¤¾ß Log4j µÄʹÓ㨸½Ô´´úÂ룩
Ô´´úÂëÏÂÔØ
Log4j ÊÇÊÂʵÉ쵀 Java ±ê×¼ÈÕÖ¾¹¤¾ß¡£»á²»»áÓà Log4j ÔÚÒ»¶¨³Ì¶ÈÉÏ¿ÉÒÔ˵ÊǺâÁ¿Ò»¸ö¿ª·¢ÈËÔ±ÊÇ·ñÊÇһλºÏ¸ñµÄ
Java ³ÌÐòÔ±µÄ±ê×¼¡£Èç¹ûÄãÊÇÒ»Ãû Java ³ÌÐòÔ±£¬Èç¹ûÄ㻹 ......
µ±È»£¬Ê×ÏÈÒª°²×°ÓÐJDK(Ò»°ãÊÇJDK1.5.X)¡£È»ºó°²×°MySQL£¬ÕâЩ¶¼±È½Ï¼òµ¥£¬¾ßÌå¹ý³Ì¾Í²»ËµÁË¡£ÅäÖúÃÕâÁ½¸ö
»·¾³ºó£¬ÏÂÔØJDBCÇý¶¯mysql-connector-java-5.1.5.zip£¨http://www.ntu-w.lkams.kernel.org/pub/MySQL/Downloads/Connector-J/mysql-connector-java-5.1.5.zip£©¡£È»ºó½«Æä½âѹËõµ½ÈÎһĿ¼¡£ÎÒÊǽâѹµ½DÅÌ£¬È»ºó½ ......