i have this method to read data from a text file.
Code:
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new FileReader(filePath));
char[] buf = new char[1024];
String line;
while ((line=reader.readLine())!=null){
String f[] = line.split("\t");
if (line.contains(loginname))
{
fileData.append(line);
}
}
reader.close();
return fileData.toString();
If i have a text file with data like this
Username: faton
password: 6655
i want to read in to my string only the words faton and not the whole string Username: faton
Any help?