Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 android 中得到了一个 Json 格式的数据,我将它们组合起来并存储在 String 中。现在我只想要特定的字符串。
$String outPut = "Doc Name: "+name + "\nRoom No: " + number+ "\nTime:"+time; Doc Name: John Room No: 12 Time: 09:00:00
我只想得到“John”、“12”和“09:00:00”。
String[] parts = outPut.split(":"); System.out.println(parts[1]);//prints John System.out.println(parts[3]);//prints 12 System.out.println(parts[5]+":"+parts[6]+":"+parts[7]);//prints 09:00:00