Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java»ù´¡£ºµÚÊ®°Ë½² StringÓ÷¨£¨ÉÏ£©

StringÊDZȽÏÌØÊâµÄÊý¾ÝÀàÐÍ£¬Ëü²»ÊôÓÚ»ù±¾Êý¾ÝÀàÐÍ£¬µ«ÊÇ¿ÉÒÔºÍʹÓûù±¾Êý¾ÝÀàÐÍÒ»ÑùÖ±½Ó¸³Öµ£¬²»Ê¹ÓÃnew¹Ø¼ü×Ö½øÐÐʵÀý»¯¡£Ò²¿ÉÒÔÏñÆäËûÀàÐÍÒ»ÑùʹÓùؼü×Önew½øÐÐʵÀý»¯¡£ÏÂÃæµÄ´úÂ붼ÊǺϷ¨µÄ£º
   String s1 = "this is a string!";
   String s2 = new String("this is another string!");
ÁíÍâStringÔÚʹÓõÄʱºò²»ÐèÒªÓÃimportÓï¾äµ¼È룬»¹¿ÉÒÔʹÓÓ+”ÕâÑùµÄÔËËã·û¡£Èç¹ûÏë°Ñ×Ö·û´®Á¬½ÓÆðÀ´£¬¿ÉÒÔʹÓÓ+”Íê³É¡£ÀýÈ磺s1+s2¡£
StringµÄһЩ³£Ó÷½·¨ÈçÏ¡£ÎªÁË˵Ã÷·½·¨£¬·½·¨ÖÐʹÓõÄʾÀý×Ö·û´®Îª£ºstr=“this is a test!”;
Ç󳤶È
·½·¨¶¨Ò壺public int length() ¡£
·½·¨ÃèÊö£º»ñÈ¡×Ö·û´®ÖеÄ×Ö·ûµÄ¸öÊý¡£
ÀýÈ磺
str.length()
½á¹û£º
15
»ñÈ¡×Ö·û´®ÖеÄ×Ö·û
·½·¨¶¨Ò壺public char charAt(int index)¡£
·½·¨ÃèÊö£º»ñÈ¡×Ö·û´®ÖеĵÚindex¸ö×Ö·û£¬´Ó0 ¿ªÊ¼¡£
ÀýÈ磺
str.charAt(3)
½á¹û£º
s
×¢Ò⣺ÊǵÚ4 ¸ö×Ö·û¡£
È¡×Ó´®
ÓÐÁ½ÖÖÐÎʽ¡£ÐÎʽһÈçÏ£º
·½·¨¶¨Ò壺public String substring(int beginIndex,int endIndex)¡£
·½·¨ÃèÊö£º»ñÈ¡´ÓbeginIndex ¿ªÊ¼µ½endIndex ½áÊøµÄ×Ó´®£¬°üÀ¨beginIndex£¬²»°üÀ¨endIndex¡£
ÀýÈ磺
str.substring(1,4)
½á¹û£º
his
ÐÎʽ¶þÈçÏ£º
·½·¨¶¨Ò壺public String substring(int beginIndex)
·½·¨ÃèÊö£º»ñÈ¡´ÓbeginIndex ¿ªÊ¼µ½½áÊøµÄ×Ó´®
ÀýÈ磺
str.substring(5)
½á¹û£º
is a test!
¶¨Î»×Ö·û»òÕß×Ö·û´®
ÓÐ4ÖÖÐÎʽ¡£ÐÎʽһÈçÏ£º
·½·¨¶¨Ò壺public int indexOf(int ch)
·½·¨ÃèÊö£º¶¨Î»²ÎÊýËùÖ¸¶¨µÄ×Ö·û¡£
ÀýÈ磺
str.indexOf(‘i’)
½á¹û£º
2
ÐÎʽ¶þÈçÏ£º
·½·¨¶¨Ò壺public int indexOf(int ch,int index)
·½·¨ÃèÊö£º´Óindex¿ªÊ¼¶¨Î»²ÎÊýËùÖ¸¶¨µÄ×Ö·û¡£
ÀýÈ磺
str.indexOf(‘i’,4)
½á¹û£º
5
ÐÎʽÈýÈçÏ£º
·½·¨¶¨Ò壺public int indexOf(String str)
·½·¨ÃèÊö£º¶¨Î»²ÎÊýËùÖ¸¶¨µÄ×Ö·û´®¡£
ÀýÈ磺
str.indexOf("is")
½á¹û£º
2
ÐÎʽ4ÈçÏ£º
·½·¨¶¨Ò壺public int indexOf(String str,int index)
·½·¨ÃèÊö£º´Óindex¿ªÊ¼¶¨Î»strËùÖ¸¶¨µÄ×Ö·û´®¡£
ÀýÈ磺
str.indexOf("is",6)
½á¹û£º
-1±íʾûÓÐÕÒµ½
Ìæ»»×Ö·ûºÍ×Ö·û´®
ÓÐ3ÖÖÐÎʽ¡£ÐÎʽһÈçÏ£º
·½·¨¶¨Ò壺public String replace(char c1,char c2)
·½·¨ÃèÊö£º°Ñ×Ö·û´®ÖеÄ×Ö·ûc1Ìæ»»³É×Ö·ûc2
ÀýÈ磺
str.replace('i','


Ïà¹ØÎĵµ£º

ºêÌìÆóÒµ°æ(JAVAƽ̨)OA¿ªÔ´ÁË

ÔÚ½ñÄê11Ô·ݣ¬ºêÌìÈí¼þ¿ª·ÅÁ˹«Ë¾µÄ¿ªÔ´°æOA 1.2
beta°æ±¾£¬µÃµ½Í¬ÐÐÒÔ¼°ÆóÒµµÄÈÈÁÒÏìÓ¦£¬¹«Ë¾Ò²¼Ó½ôÁËÏÂÒ»²½µÄ¿ªÔ´µÄ²½·¥£¬ºêÌìÈí¼þ°ÑÏÖÐеÄÆóÒµ°æ1.2.1Ò²¶ÔËùÓÐÆóÒµ¿ª·ÅÔ´´úÂ루ÔÝʱ²»¶Ô¸öÈË¿ª
·Å£¬ËäȻĿǰÓкܶà¸öÈ˼°Èí¼þ¿ª·¢ÊÒÇ¿ÁÒÒªÇ󣩣¬ÆóÒµÖ»ÐèÒª»¨ÉÏÍòÔª×óÓÒ£¬¾Í¿ÉÒÔ¹ºÂò¸Ã°æ±¾µÄÈ«²¿´úÂ룬²¢»ñµÃÊÚȨ»ùÓÚ´ËÏ ......

Java I/O³£ÓÃÁ÷ʾÀý

package io;
import java.io.*;
/**
* @author ¸ßÕíÎâÓÇ
* ÀûÓûº³åÇøÔ­Àí,BufferedInputStream,
* ʵÏÖµÄÎļþ×Ö½ÚÁ÷¶ÁÈ¡¹¦ÄÜʾ·¶
*
*/
public class BufferedInOutputStream {
public BufferedInOutputStream() {
ioTest2();
}
public void ioTest2() {
FileInputStream in = null ;
Buffered ......

Javaµ÷ÓÃÍⲿ³ÌÐò

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class CmdTest {
    private static final long serialVersionUID = -2650474785662737262L;
    public static void main(String[] args) throws Exception {
  &n ......

java ¾ø¶Ô·¾¶¹¤¾ßÀà

ÔÚ³ÌÖÐÎÒÃdz£È¡Ò»Ð©×ÊÔ´µÄ¾ø¶Ô¾¶£¬ÏÂÃæ¸ø³öÒ»¸ö¼òµ¥·½±ãµÄ¹¤¾ßÀàÀ´°ïÖúÎÒÃÇÇáËɵÄÕÒµ½ÎÒÏëµÄ×ÊÔ´¡££¨ÊÊÓÃÓÚCS/BSÓ¦Óã©
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/** *//**
* @author <a href="mailto:maryang@live.cn" mce_hre ......

JAVAÖз½·¨ºÍ±äÁ¿Ôڼ̳ÐÖеĸ²¸ÇºÍÒþ²Ø

http://renyanwei.javaeye.com/blog/258304
ÎÒÃÇÖªµÀ£¬ÔÚJAVAÖУ¬×ÓÀà¿ÉÒԼ̳и¸À࣬Èç¹û×ÓÀàÉùÃ÷µÄ·½·¨Ó븸ÀàÓÐÖØÃûµÄÇé¿öÔõô°ì£¬´ó»ï¶ù¶¼ÖªµÀÒªÊÇÖØд£¬µ«ÊÇʵ¼ÊÉÏÕâÓÖ·ÖΪÁ½ÖÖÇé¿ö£¬¾ÍÊÇ·½·¨ºÍ±äÁ¿Ôڼ̳ÐʱµÄ¸²¸ÇºÍÒþ²ØÎÊÌ⣬ÕâЩ¸ÅÄîÐԵĶ«Î÷¿´ËÆÎÞÁÄ£¬µ«ÊÇÔÚÃæÊÔ»òÕßÊÇSCJPÈÏÖ¤ÌâÖÐΧÈÆÕâЩÊǻᾭ³£Åöµ½µÄ£¬ËùÒÔÕâÀï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ