1 回答
TA贡献1803条经验 获得超6个赞
可以用正则表达式来分割
public class Test {
public static void main(String[] args) {
String s = "24:a2:e1:29:60:48 Tue Jun 24 08:29:312014videoXNzE0MjI0NTM2clicked24:a2:e1:29:60:48 Tue Jun 24 08:29:39 2014video endVideo details:Total duration: 106.930000 minsViewing time: 5.600000 secsDevice operation: iosVideo ID: XNzE0MjI0NTM224:a2:e1:29:60:48 Tue Jun 24 08:30:09 2014videoXNzE1NDExMzk2 clicked24:a2:e1:29:60:48 Tue Jun 24 08:31:34 2014video endVideo details:Total duration: 3.160000 minsViewing time: 84.630000 secsDevice operation: iosVideo ID: XNzE1NDExMzk2";
String lines = s.replaceAll("(Video ID:\\s*.{13})", "$1" + System.getProperty("line.separator", "\n"));
System.out.println(lines);
}
}
添加回答
举报