How to handle a multi line textarea string in java. Here example of my strings:
eg 1:
!1234 //here after !1234 there is some white space
ADFGKLJUYGHH
eg 2:
!123455//here after!1234555 there is no space
ASDFGERTYUJDCVBNMFGH
I know how to handle these strings when reading from a file but now i have read from a JTextArea and perform some function for those read strings.(Here we should consider only the second line of a string the first should be ignored)
How to do that?
The code for the reading from a file or from console is:
line=br.readLine();
while (line!=null)
{
if (line.length() != 0 && line.charAt(0) == '>')
{
String name = line.trim();
System.out.println(name);
StringBuffer sb = new StringBuffer();
line = br.readLine();
while(line!=null &&line.length()==0)
{
line = br.readLine();
}
while (line!=null &&line.charAt(0) != '>')
{
sb.append(line);
if (line!=null)
{
line = br.readLine();
}
else
{
break;
}
}
String ss = sb.toString();
operation(seq,name,fnew,num);
}
else
{
line = br.readLine();
}
}
// br.close();
// bufferFileWriter.close();
}