有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

在java中解析如何从字符串中读取第二行

我有一个包含多行的字符串,我想读取一个特定的行并将其保存到另一个字符串中。这是我的密码

String text ="example text line\n
example text line\n
example text line\n
example text line\n
example text line\n
example text line\n
example text line\n";

String textline1="";
String textline2="";

在上面的字符串textline1和textline2中,我想保存特定的行


共 (0) 个答案