split用法举例

来源:互联网 发布:js调用手机相册插件 编辑:程序博客网 时间:2024/04/30 18:54
import java.io.FileWriter;
import java.util.Properties;




public class Mysplit {


public static void main(String[] args) {
String s ="http://localhost:8088/abc?name=john&sex=男";
int index =s.indexOf("?");
String x =s.substring(index+1);
Properties pro =new Properties();
String []strArray =x.split("&");
for(String str:strArray){
String[] temp =str.split("=");
pro.setProperty(temp[0], temp[1]);
System.out.println(str);
}
try{
pro.store(new FileWriter("src/age.txt"),null);
}catch(Exception e){
e.printStackTrace();
System.out.println("eeeee");
}



}


}
0 0
原创粉丝点击