在java中解析到字符串结尾并检查行尾

在java中解析到字符串结尾并检查行尾,java,Java,我将.txt文件中的以下内容存储到字符串变量actual\u text 111147 2222292 333381 因此,现在实际文本将具有该值 111147 2222292 333381 我试图从下面的片段中实现两个目标 while(parse till end of string condition) //parse till the end actual_text { if(end of line condition) //chec

我将.txt文件中的以下内容存储到字符串变量actual\u text

111147

2222292

333381

因此,现在实际文本将具有该值

111147

2222292

333381

我试图从下面的片段中实现两个目标

while(parse till end of string condition)      //parse till the end actual_text
        {
            if(end of line condition)     //checking for the "\n" string in actual_text
            {
                                  //random code 
            }
                }

有谁能告诉我如何在上面的程序中解析和检查行尾。

您是否使用扫描仪来读取文本,因为如果您使用扫描仪,您将无法在实际文本中读取。如果你不知道,你可能应该看看它,因为我认为它会帮助你。你的目标是逐行解析文本文件吗?@lins314159我不知道如何检查字符串结束条件,但对于行结束,我知道它是实际的文本。equals(“\n”)@lynxoid是,不使用bufferedreader和readline。
for (String line : actual_text.split("\\n"))
{
     //process each line
}