ÊÕ¼¯µ½µÄ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); &n
Ïà¹ØÎĵµ£º
Java¶ÁÈ¡PropertiesÎļþµÄÁùÖÖ·½·¨
Java¶ÁÈ¡propertiesÎļþ
ʹÓÃJ2SE API¶ÁÈ¡PropertiesÎļþµÄÁùÖÖ·½·¨
1¡£Ê¹ÓÃjava.util.PropertiesÀàµÄload()·½·¨
ʾÀý£º InputStream in = lnew BufferedInputStream(new FileInputStream(name));
Properties p = new Properties();
p.load(in);
2¡£Ê¹ÓÃjava.util.ResourceBundleÀ ......
Ò».ÓÃÒýÓòÙ×ݶÔÏó
ÿÖÖ±à³ÌÓïÑÔ¶¼ÓÐ×Ô¼ºµÄÊý¾Ý²Ù×Ý·½Ê½¡£ÓÐʱºò£¬³ÌÐòÔ±±ØÐë×¢Ò⽫Ҫ´¦ÀíµÄÊý¾ÝÊÇʲôÀàÐÍ¡£ÄãÊÇÖ±½Ó²Ù×ݶÔÏ󣬻¹ÊÇÓÃijÖÖ»ùÓÚÌØÊâÓï·¨µÄ¼ä½Ó±íʾ(ÀýÈçCºÍC++ÀïµÄÖ¸Õë)ÔÚ²Ù×ݶÔÏó?
ËùÓеÄÕâÒ»ÇÐÔÚjavaÀﶼµÃµ½Á˼ò»¯ ......
µÝ¹éËã·¨Éè¼ÆµÄ»ù±¾Ë¼ÏëÊÇ£º¶ÔÓÚÒ»¸ö¸´ÔÓµÄÎÊÌ⣬°ÑÔÎÊÌâ·Ö½âΪÈô¸É¸öÏà¶Ô¼òµ¥ÀàͬµÄ×ÓÎÊÌ⣬¼ÌÐøÏÂÈ¥Ö±µ½×ÓÎÊÌâ¼òµ¥µ½Äܹ»Ö±½ÓÇó½â£¬Ò²¾ÍÊÇ˵µ½Á˵ÝÍƵijö¿Ú£¬ÕâÑùÔÎÊÌâ¾ÍÓеÝÍƵý⡣
¹Ø¼üҪץסµÄÊÇ£º
£¨1£©µÝ¹é³ö¿Ú
£¨2£©µØÍÆÖð²½Ïò³ö¿Ú±Æ½ü
Àý×Ó:
example£º Çó5µÄ½×³Ë¡£¡£ & ......
java 5¿ªÊ¼ÒýÈëÁËautoboxing ºÍauto-unboxing»úÖÆ£¬·½±ãÁË»ù±¾ÀàÐͺÍÆä¶ÔÓ¦µÄwrapperÀàÐ͵Äת»»¡£±ÈÈçÎÒÃÇ¿ÉÒÔÖ±½Ó°ÑÒ»¸ö»ù±¾ÀàÐ͵ÄÖµ¸³¸øÆäwrapperÀàÐÍ£¬·´Ö®ÒàÈ»£»¿ÉÒÔ°ÑÒ»¸ö»ù±¾ÀàÐÍÖ±½Ó·ÅÈëÈÝÆ÷À·â×°µÄ¹ý³ÌÓɱàÒëÆ÷À´Íê³É£»µ÷Ó÷½·¨µÄʱºò¿ÉÒÔÖ±½ÓÆ¥Åä²ÎÊýautoboxingºÍauto-unboxingÖ®ºóµÄ°æ±¾¡£
¡¡Õâ¸ö¹ý³Ì ......
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutpu ......