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.
文字列に2つの要素があり、2番目の要素を取得して新しい文字列に入れたいと思います。
String data;
データ文字列には次のものが含まれます。
27 Nov 2012 30 Oct 2012
2つの日付は。で区切られ\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];