String功能测试

package foxe;

import java.io.IOException;
import java.util.StringTokenizer;

public class MainClass {

/**
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
  String str="1 a 67 fist";
  StringTokenizer token=new StringTokenizer(str);
  
  System.out.println("str.length="+str.length());
  //token.countToken;
  for(int i=0;i<str.length()-1;i++){
   System.out.println("i======================ii="+i);
   String sk = token.nextToken();i=i+sk.length();
   System.out.println("String sk"+i+"="+sk);
   try{
    double dou=Double.parseDouble(sk);
   System.out.println("double dou"+i+"="+dou+";   doub*3="+dou*3);
   }catch(Exception e){
    e.getMessage();
    System.out.println("chang error at "+i);
   }
   //char chars = str.charAt(i);
   //str.equals(Double);

int ints3 = str.hashCode();
   System.out.println("ints3="+ints3);

int ints4= str.indexOf(i);
   System.out.println("ints4="+ints4);

String ints7 = str.valueOf(i);
   System.out.println("ints7="+ints7);

System.out.println("ints **********************************end");

}

}

}

上一篇:Python学习系列(六)(模块)


下一篇:Python学习系列(二)(基础知识)