11.6
给定下面的HTML代码:
<font face ="Arial,Serif" size="+2"color="red">
要求对内容进行拆分,拆分之后的结果是:
face Arial,Serif
size +2
color red
package book;
public class JiOu {
public static void main(String args[]) {
String str = "<font face=\"Arial,Serif\" size=\"+2\" color=\"red\">";
String s[] = str.split(" ");
String str1 = s[1].replaceAll("\"|<", " ");
String str2 = s[2].replaceAll("\"", " ");
String str3 = s[3].replaceAll("\"|>", " ");
String s1[] = str1.split("=");
String s2[] = str2.split("=");
String s3[] = str3.split("=");
System.out.println(s1[0] + " " + s1[1]);
System.out.println(s2[0] + " " + s2[1]);
System.out.println(s3[0] + " " + s3[1]);
}
}
运行结果:
face Arial,Serif
size +2
color red