public class Test {
public static void main(String[] args) {
    String s1="how are you";
    String s2=new String("ni hao");
    //System.out.println(s1.indexOf('h'));//查找Char字符在字符串中的索引
   //System.out.println(s1.indexOf("are"));//查找String字符在字符串中的索引
    System.out.println(s1.indexOf("re",1));//从检索为1的位置搜索re的检索位置为5
    //System.out.println(s1.charAt(1));//"how are you"-----o
}
}
===========================================================
package com.java.lka;

public class Test1 {
public static void main(String[] args) {
    String s1="343183852@qq.com";
    System.out.println(s1.length());
    if(s1.length()==16){
        if(s1.indexOf('@')'.')&&s1.indexOf('@')>0){
            System.out.println("邮箱格式正确");
        }
    }else{
        
            System.out.println("邮箱格式错误");
        }
    }
    
}
==============================================================
package com.java.lka;

public class Test2 {
public static void main(String[] args) {
    String s1="asd";
            String s2="Asd";
            String s3="asd####Asd";
            if(s1.equalsIgnoreCase(s2)){
                System.out.println("忽略大小写后相等");
            }else{System.out.println("忽略大小写后不相等");}
            System.out.println(s1.compareTo(s2)+"按字典排序");
            System.out.println(s1.compareToIgnoreCase(s2)+"忽略大小写的按字典排序");
            if(s3.startsWith(s1)&&s3.endsWith(s2)){
            System.out.println("是s1开头"+"并且是s2结尾");
            }else{
                System.out.println("既不是s1开头"+"并且不是s2结尾");
            }
}
}
=================
package com.java.lka;

public class Test3 {
    public static void main(String[] args) {
        
    
String s1="123,asd,d 13d";
String s2="lk";
String s3=" lk ";
String s4="lk ";

System.out.println(s1.substring(4));
System.out.println(s1.substring(4,10));
//System.out.println(s1.lastIndexOf(s1));
System.out.println(s1.concat(s2));
System.out.println(s3.trim());
System.out.println(s4.trim());
System.out.println(s1.replace(s1.substring(4,6),s2));
}
    }
package com.java.lka;

public class Test4 {
    public static void main(String[] args) {
        
    
String name="woaizhongguo";
String[] str1=name.split("o");//按o分割
String name1="Asd";
String[] str2=name.split("o", 2);//按o分割成2部分
for (int i = 0; i < str2.length; i++) {
    System.out.println(str2[i]);
}
System.out.println(name1.toUpperCase());
System.out.println(name1.toLowerCase());
}
}
package com.java.lka;

public class Test5 {
public static void main(String[] args) {
    String name="D:\\workspace\\Day3\\src\\lk\\a.txt";
    String name2="D:/workspace/Day3/src/lk/a.txt";
    String name1="a.txt";
    name.lastIndexOf("\\");
    System.out.println(name.substring(name.lastIndexOf("\\")+1));
    String[] str1=name2.split("/");
    for (int i = 0; i < str1.length; i++) {
        System.out.println(str1[i]);
    }
    for (int j = 0; j < str1.length; j++) {
        if(str1[j].equals(name1)){
            System.out.println(str1[j]);
        }
    }
}
}
package com.java.lkb;

public class Test {
    public static void main(String[] args) {
        
    StringBuffer s1=new StringBuffer();
    StringBuffer s2=new StringBuffer(32);
    StringBuffer s3=new StringBuffer("asdf");
//System.out.println(s3.append('c'));
//System.out.println(s3.append("lkqwr",2,4));
//System.out.println(s3.append(true));
//System.out.println(s3.append(new char[]{'g','j','k','l'},0,3));
s3.setCharAt(1,'k');
    System.out.println(s3);
//StringBuffer ss1=s3.reverse();
//System.out.println(s3);
    s3.replace(1, 3,"lk");
    System.out.println(s3);
    s3.insert(1,true);
    System.out.println(s3);
    s3.delete(1,3);
    System.out.println(s3);
    }
}
package com.java.lkb;

public class Test1 {
public static void main(String[] args) {
    String str=" asfg ";
    byte[] buf=str.getBytes();
    for (int i = 0; i < buf.length; i++) {
        System.out.println(buf[i]);
    }
    char[] cha=new char[4];
    str.getChars(0, 4, cha,0);
    for (int j = 0; j < cha.length; j++) {
        System.out.println(cha[j]);
    }
    String s11=new String(buf,0,buf.length);
    System.out.println(s11);

    System.out.println(String.valueOf(s11.isEmpty()));
    StringBuffer buff=new StringBuffer("woaizhongguo");    
    buff.append(true);
   // buff.append(cha);
    //buff.append(cha,1,3);
    System.out.println(buff);
    buff.setCharAt(2, 'w');
    buff.delete(1, 3);
    System.out.println(buff);
    buff.deleteCharAt(13);//无返回值
    System.out.println(buff);
    buff.insert(2, true);
    buff.reverse();
    System.out.println(buff);
    buff.replace(1, 12, "dasf");
    System.out.println(buff);
    String a=str.toLowerCase();//有返回值
    System.out.println(a);
   String b=str.toUpperCase();
    System.out.println(b);
   String b11=str.toLowerCase().concat(str.toUpperCase());
    System.out.println(b11);
   String t=str.trim();
   System.out.println(t);
   String r=str.replace('a', 'l');
   System.out.println(r);
    String s=str.substring(2);
    System.out.println(s);
   String s1=str.substring(2,3);//截取范围类的字符串生成新的字符串
   System.out.println(s1);
   
}
}
public int clu(int x){
int i=0;
    try {
        i=x/3;
    } catch (Exception e) {
        System.out.println("无穷");
    }
    return i;
}
}
package com.java.lkd;

public class Test1 {
public static void main(String[] args) {
    Test t1=new Test();
    System.out.println(t1.clu(12));
}
}