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.
我的字符串中有两个元素,我想取第二个元素并放入一个新字符串。
String data;
数据字符串包含:
27 Nov 2012 30 Oct 2012
两个日期用 . 分隔\n。
\n
任何帮助表示赞赏:)
String first = data.substring(0, data.indexOf("\n")); String second = data.substring(data.indexOf("\n"));
希望有帮助!
另一种方法:
String dates[] = data.split("\n"); String second = dates[1];