Is there a way to substring by the string line?
Someting like: String.substring(line_num);
Or we hava to do it manually by calculating the indexes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, that’s not possible. You can, however, split the string by
\nand then get the required line:If you don’t know what the line separator of your platform is, use
System.getProperty("line.separator").Or if you want to get a range of lines, use
Arrays.copyOfRange():