ÊÕ¼¯µ½µÄjava ÕýÔòÑéÖ¤
Java´úÂ룺
import java.util.regex.*;
public final class RegExpValidator
{
/**
* ÑéÖ¤ÓÊÏä
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean isEmail(String str)
{
String regex = "^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
return match(regex, str);
}
/**
* ÑéÖ¤IPµØÖ·
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏ¸ñʽµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean isIP(String str)
{
String num = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";
String regex = "^" + num + "\\." + num + "\\." + num + "\\." + num + "$";
return match(regex, str);
}
/**
* ÑéÖ¤ÍøÖ·Url
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏ¸ñʽµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean IsUrl(String str)
{
String regex = "http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?";
return match(regex, str);
}
/**
* ÑéÖ¤µç»°ºÅÂë
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏ¸ñʽµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean IsTelephone(String str)
{
String regex = "^(\\d{3,4}-)?\\d{6,8}$";
return match(regex, str);
}
/**
* ÑéÖ¤ÊäÈëÃÜÂëÌõ¼þ(×Ö·ûÓëÊý¾Ýͬʱ³öÏÖ)
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏ¸ñʽµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean IsPassword(String str)
{
String regex = "[A-Za-z]+[0-9]";
return match(regex, str);
}
/**
* ÑéÖ¤ÊäÈëÃÜÂ볤¶È (6-18λ)
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ
Ïà¹ØÎĵµ£º
java×öµÄϵͳ¸øÈ˵ÄÓ¡ÏóÊÇʲô£¿Õ¼Äڴ棡˵µÀÕâ¾ä»°¾Í»áÓÐN¶àÈËÕ¾³öÀ´Îªjava±ç»¤£¬²¢¾Ù³öÒ»¶ÑµÄÐÔÄܲâÊÔ±¨¸æÀ´Ö¤Ã÷ÕâÒ»µã¡£Æäʵ´ÓÀíÂÛÉÏÀ´½²java×öµÄϵͳ²¢²»±ÈÆäËûÓïÑÔ¿ª·¢³öÀ´µÄϵͳ¸üÕ¼ÓÃÄڴ棬ÄÇôΪʲôȴÓÐÕâôN¶àÀíÓÉÀ´Ö¤Ã÷ËüȷʵռÄÚ´æÄØ£¿Á½¸ö×Ö£¬ÂªÏ°¡£
£¨1£©±ðÓÃnew Boolean()¡£
Ôںܶೡ¾°ÖÐBooleanÀàÐÍÊDZØÐ ......
1 Èç¹ûÒ»¿éÄÚ´æÇøÓòÄܹ»Öظ´ÀûÓã¬×îºÃ²»ÒªÉêÇëеġ£Õâ¸öÄÚ´æÇøÓòÓпÉÄÜÊÇϵͳµÄÒ»¸öÀ࣬×Ô¼ºµÄÒ»¸öÄÚ²¿ÓÐÊý×éÔªËØ£¬»òÕßÄܹ»·Å´óÁ¿Êý¾ÝµÄ½á¹¹¡£
2 ×îºÃ²»ÒªÔÚÑ»·ÀïÃæÉêÇëÄڴ棬ѻ·Ô½´ó£¬Ô½»µÊ¡£»»¾ä»°Ëµ£¬ÉêÇëÄÚ´æƵÂʱðÌ«¸ß¡£ºÃ±ÈÒ»¸öÈËÿ¶Ù³ÔÁ½Íë·¹ÕýºÃ£¬ÉíÌåµÄÏû»¯ÏµÍ³¿ÉÒÔ³ÐÊÜ£¬Èç¹ûÈÃËûÒ»¶Ù°ÑÊ®¶ÙµÄ¶¼³Ôµô£¬²»ÕÍ ......
1)¾²Ì¬±äÁ¿±¾Éí²»»á±»»ØÊÕ
2)¾²Ì¬±äÁ¿ËùÒýÓõĶÔÏóÊÇ¿ÉÒÔ»ØÊյġ£
µÚÒ»µã´ó¼ÒÓ¦¸ÃûÓÐÒÉÎÊ£¬ÏÂÃæÎÒÖ¤Ã÷µÚ£²µã£º
¿´ÏÂÃæµÄÀý×Ó¼°×¢ÊÍ¡£×Ô¼º¿ÉÒÔÔËÐÐÊÔÒ»ÏÂ,¡¡×¢Òâ¼ÓÉÏ-verbose:gc²ÎÊý
java -verbose:gc TestStaticGc
// TestStaticGc.java
public class TestStaticGc {
& ......
Õ⼸ÌìÔÚ¿´JAVA£¬Í¼Êé¹Ý½èµÄÒ»±¾JAVA¿ª·¢´óÈ«£¬Í¦ºñµÄÒ»±¾£¬ÄÚÈݺܶ࣬µ«²»Éî¡£°üÀ¨JAVAµÄ»ù±¾Óï·¨¡¢Ï̱߳à³Ì¡¢×ÀÃæ³ÌÐò¡¢Ö÷ÒªÀà¿â¡¢ÒÔ¼°ºóÃæJSP²¿·Ö¡£¿´ÁË5ÌìÁË£¬¸Õ°ÑJÏ߳̿´Íê¡£ÓÉÓÚ֮ǰѧ¹ýC++£¬ËùÒÔÇ°Ãæ»ù´¡Êý¾ÝÀàÐÍ£¬»ù±¾Óï·¨µÈµÈÖ»×ÅÖØ¿´¿´JAVA¶ÀÌصĵط½¡£ÒÔÏÂÊÇÎÒ¸öÈËÀí½â×ܽáµÄһЩJAVAÓëC/C++²»Í¬µØ·½¼°×Ô¼ºµÄ¶ÔJ ......
Êý¾Ý¿âÁ¬½Ó
Á÷ÊÇÖ¸Ò»Á¬´®Á÷¶¯µÄ×Ö·û£¬ÊÇÒÔÏȽøÏȳöµÄ·½Ê½´¦ÀíµÄ¡£
¹¹ÔìÒ»¸öÎļþÊäÈëÁ÷¶ÔÏó£ºInputStream o = new FileInputStream(“a.txt&rdquo ......