string的常用方法

import java.io.*;
import java.util.*;


class Cal
{                 //12345
public void run(){
String s="abc";
//char c=s.charAt(4);
//boolean b=s.contains("ab");
//boolean b=s.equals("abc");
//int b=s.compareTo("dbc");  //-3
/*
char[] b=new char[s.length()];
s.getChars(0,3,b,0);  //abc
*/
//boolean b=s.isEmpty();
//int b=s.indexOf('c'); //2
//int b=s.indexOf("bc");//1
//String[] b=s.split("/");  //s="a/bc"
//String b=s.replace('a','h');
//String b=s.replace("ab","h");
//char[] b=s.toCharArray();
//String b=s.substring(0,3);
System.out.println(b);
}
}


public class Demo
{
public static void main(String[] args) throws IOException {
Cal c=new Cal();
c.run();


}

你可能感兴趣的:(string的常用方法)