java StringTokenizerµÄÓ÷¨
StringTokenizer Õâ¸öÀàÆäʵÕæÕýÏîÄ¿ÀïÃæ¿ÖźÜÉÙ»áÓðɣ¿µ«ÊÇÕâ¸öÀàÕæµÄºÜʵÓã¬ÒòΪËü¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄ·½Ê½°´ÕÕÒ»¶¨µÄ¹æÔòÀ´²ð·ÖÒ»¸ö×Ö·û´®
String s = new String("The Java platform is the ideal platform for network computing");
//ĬÈϵĹ¹Ô캯Êý£¬»áĬÈÏ¿Õ¸ñÊÇ·Ö¸ô·û
StringTokenizer st = new StringTokenizer(s);
//¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄ¹æÔòÀ´²ð·Ö×Ö·û´®£¬Ä¿Ç°µÄ¹æÔòÊÇÒÔ“l”µ±×÷·Ö¸ô·û
StringTokenizer st1 = new StringTokenizer(s,"l");
//ÕâÀïtrueµÄº¬ÒåÊǽ«“l”Ò²×÷Ϊһ¸ötoken£¬¶øÈç¹û²ÎÊýÌîÈëfalseµÄ»°Ôò²»½«“l”×÷Ϊtoken
StringTokenizer st2 = new StringTokenizer(s,"l",true);
System.out.println( "Token Total: " + st.countTokens() );
while(st.hasMoreElements()){
System.out.println(st.nextElement());
}
²»¹ýÔÚjdkÎĵµÖУ¬²¢²»ÌᳫÔÙʹÓÃStringTokenÀàÁË£¬ËüÖ»ÊÇ×÷Ϊһ¸öÒÅÁôÀà¶ø±£´æÔÚÁËjdkÖС£ÏÖÔÚÌᳫʹÓÃ
StringÀàµÄsplit·½·¨»òÕßÊÇjava.util.regex°ü¡£
ÏÂÃæ¾Í½«StringµÄsplit·½·¨Ð´ÁËÒ»µã´úÂ룺
public class aa {
public static void main(String args[])
{
String s="ÎÒÕâÖ»ÊÇϲ»¶.²»andÊÇ°®";
//ÕâÀï±ØÐëʹÓÃ\\À´Ö¸Ã÷ÎÒÃÇʹÓÓ.”À´·Ö¸î×Ö·û´®¡£Èç¹ûÐèÒª½«Ò»¸ö×Ö·û´®Óò»Í¬µÄ×Ö·û·Ö¸îµÄ»°£¬¿ÉÒÔÓÓ£ü”×÷ΪÁ¬½Ó·û
String[] ss=s.split("\\.|and");
int i=0;
while(i<ss.length)
{
Ïà¹ØÎĵµ£º
ËäÈ»²»¾õµÃÔÚ±à³ÌʱÕýÈ·ÅжÏjavaÀà³õʼ»¯¹¤×÷ÏȺó˳Ðò»áÊÇÒ»¸öÌôÕ½£¬ÇÒ¶ÔÓÚÀà³õʼ»¯µÄÈÏʶ»¹Ö»Í£ÁôÔÚÓïÑÔÌØÐÔ»úÖƵIJãÃæ(»òÐí»áÊÇÒ»ÖÖʵÏÖ¼¼ÇÉÁìÓòµÄÒéÌâ)£¬µ«¶ÔÓÚ¹ØÓÚ³õʼ»¯ÕâÀàÁãÉ¢¶øÓÖϸСµÄ֪ʶµã£¬×ܽỹÊÇÓмÛÖµµÄ ......
1.InputStreamºÍOutputStreamÊÇÓÃÓÚ¶Á»òдµ¥¸ö×Ö½Ú»òÕß×Ö½ÚÊý×飬ÎÒÃǺÜÉÙÓõ½ËüÃǵķ½·¨£¬ËüÃÇÖ®ËùÒÔ´æÔÚÊÇÒòΪ±ðµÄÀà¿ÉÒÔʹÓÃËüÃÇ£¬ÒÔ±ãÌṩ¸üÓÐÓõĽӿڡ£Òò´Ë£¬ÎÒÃǺÜÉÙʹÓõ¥Ò»µÄÀàÀ´´´½¨Á÷¶ÔÏ󣬶øÊÇͨ¹ýµþºÏ¶à¸ö¶ÔÏóÀ´ÌṩËùÆÚÍûµÄ¹¦ÄÜ¡£
2.FilterInputStreamºÍFilterOutputStreamÊÇÓÃÀ´ÌṩװÊÎÆ÷Àà½Ó¿ÚÒÔ¿ØÖÆÌض¨ ......
ÍøÂçµÄ¸ÅÄî:Ï໥Á¬½Ó,¶ÀÁ¢×ÔÖ÷
ÍøÂçÓë·Ö²¼Ê½¼¯ÈºÏµÍ³µÄÇø±ð£ºÃ¿¸ö½Úµã¶¼ÊÇһ̨¼ÆËã»ú£¬¶ø²»ÊǸ÷ÖÖ¼ÆËã»úÄÚ²¿µÄ¹¦ÄÜÉ豸¡£
Ip:¾ßÓÐÈ«ÇòΨһÐÔ£¬Ïà¶ÔÓÚinternet£¬IPΪÂß¼µØÖ·£¬TCP/IPÍøÂçÖеÄÿ̨¼ÆËã»ú¶¼ÓÐΨһµÄµØÖ·--IPµØÖ·. Ψһ±êʾһ̨Ö÷»ú
ÔÚJavaÖÐ,ÓÐÒ»¸öÓÃÀ´´æ´¢internetµØÖ·µÄÀà½ÐInetAddress.
Àý:»ñÈ¡±¾» ......
µÚÒ»ÖÖ:
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
ЧÂʸß,ÒÔºóÒ»¶¨ÒªÊ¹ÓôËÖÖ·½Ê½£¡
µÚ¶þÖÖ:
Map map = new HashMap();
Iterator iter = ma ......
public static void replaceString(String source,String oldStr,String newStr){
System.out.println(source);
String result = source.replaceAll("(?i)"+oldStr
, newStr); //´óСд²»Ãô ......