字符窜操作问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:06:25
“高分急求”:如果有以下一段字符窜:NAME%11刘翔%22AGE%11三十%22PROPSITION%11运动员%22 也就是说要拿到信息:NAME刘翔AGE三十PROPSITION运动员 而他们被隔开了 现在要怎么分割 分割后拿到所要的信息,代码怎么写 谢谢大家

public class Test {

public static void main(String[] args) {
String info = "NAME%11刘翔%22AGE%11三十%22PROPSITION%11运动员%22";
String replaced = info.replaceAll("%11", ":");
replaced = replaced.replaceAll("%22", "\n");
System.out.println(replaced);
}
}

String str1=new String("NAME%11刘翔%22AGE%11三十%22PROPSITION%11运动员%22");
System.out.println(str1.replaceAll("%\\d+", ""));