javaʵÏÖÊä³ö×Ö·û´®ÖеÄÊý×Ö×Ö·û
package com.joe;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test
{
//½«×Ö·û´®µÄÊý×Ö×Ö·ûÊä³ö
public static void main(String[] args)
{
String str = "iu7i8hy4jnb2";
//·½·¨Ò»
String vString = str.replaceAll("[\\D]", ""); // [\D] == [^\d] == [^0-9]
System.out.println(vString);
//·½·¨¶þ
String regex = "\\d";
Matcher m = Pattern.compile(regex).matcher(str);
while(m.find())
{
System.out.print(m.group());
}
System.out.println();
}
}
Ïà¹ØÎĵµ£º
±¾ÈË֮ǰ×öµÄÏîÄ¿ÖлýÀÛ³£ÓõÄʱ¼ä·½·¨£¬Ìù³öÀ´Óë´ó¼Ò¹²Ïí£¬Èç¹ûÄÄÀïÓдíÎó»ò¸üÓÐЧµÄ·½·¨Ç뾡¹ÜÅÄש£¡¹þ¹þ
Java´úÂë
package com.hefeng.test;
import java.text.DateFormat;
import java.text.ParsePosition;
import&n ......
public£¨¹«¹²·ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»ËùÓÐÀà·ÃÎÊ¡£
protected£¨±£»¤·ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»Õâ¸öÀà±¾Éí¡¢ËüµÄ×ÓÀࣨ°üÀ¨Í¬Ò»¸ö°üÖÐÒÔ¼°²»Í¬°üÖеÄ×ÓÀࣩºÍͬһ¸ö°üÖеÄËùÓÐÆäËûÀà·ÃÎÊ¡£
default£¨ÓѺ÷ÃÎÊ¿ØÖÆ£©£º¿ÉÒÔ±»Õâ¸öÀà±¾ÉíºÍͬһ¸ö°üÖÐµÄÆäËûÀàËù·ÃÎÊ¡£
private£¨Ë½ÓзÃÎÊ¿ØÖÆ£©£ºÖ»Äܱ»¸ÃÀà×ÔÉí·ÃÎʺÍÐ޸ġ£ ......
Java±à³ÌÄÇЩʶù78——ʱ¼äºÍÈÕÆÚ´¦Àí
9.6 java.util°ü
java.util°üÊÇJavaÓïÑÔÌṩµÄ¹¤¾ßÀà°ü£¬¸Ã°üÖаüº¬ÁËÈçÈÕÆÚ¡¢Ëæ»úÊýºÍÊý¾Ý½á¹¹ÊµÏÖÀàµÈһϵÁеŤ¾ßÀàʵÏÖ£¬ÊÇѧϰJavaÓïÑԵĻù´¡°üÖ®Ò»¡£
9.6.1 ʱ¼äºÍÈÕÆÚ´¦Àí
ʹÓóÌÐò½øÐÐʱ¼äº ......
ÍøÂç±à³ÌµÄʵÖʾÍÊÇÁ½¸ö£¨»ò¶à¸ö£©É豸£¨ÀýÈç¼ÆËã»ú£©Ö®¼äµÄÊý¾Ý´«Êä¡£
ÍøÂç×îÖ÷ÒªµÄÓÅÊÆÔÚÓÚ¹²Ïí£º¹²ÏíÉ豸ºÍÊý¾Ý£¬ÏÖÔÚ¹²ÏíÉ豸×î³£¼ûµÄÊÇ´òÓ¡»ú£¬Ò»¸ö¹«Ë¾Ò»°ãÒ»¸ö´òÓ¡»ú¼´¿É£¬¹²ÏíÊý¾Ý¾ÍÊǽ«´óÁ¿µÄÊý¾Ý´æ´¢ÔÚÒ»×é»úÆ÷ÖУ¬ÆäËüµÄ¼ÆËã»úͨ¹ýÍøÂç·ÃÎÊÕâЩÊý¾Ý£¬ÀýÈçÍøÕ¾¡¢ÒøÐзþÎñÆ÷µÈµÈ¡£
µ«ÊÇ£¬½øÐÐÍøÂç±à³Ìʱ£¬Ö»ÓÐIP ......
Ò»¡¢static
ÇëÏÈ¿´ÏÂÃæÕâ¶Î³ÌÐò£º
public class Hello{
public static void main(String[] args){//(1)
System.out.println("Hello,world!");//(2)
}
}
¿´¹ýÕâ¶Î³ÌÐò£¬¶ÔÓÚ´ó¶àÊýѧ¹ýJava µÄ´ÓÀ´Ëµ£¬¶¼²»Ä°Éú¡£¼´Ê¹Ã»ÓÐѧ¹ýJava£¬¶øÑ§¹ýÆäËüµÄ¸ß¼¶ÓïÑÔ£¬ÀýÈçC£¬ÄÇÄúÒ²Ó¦¸ÃÄÜ¿´¶®Õâ¶Î´úÂëµÄÒâ˼¡£ËüÖ»ÊǼòµ ......