I've a problem with the following code:
public String SearchText(String fileName, String First, String Last) {
String tag = new String();
String file = FileUtils.readFileToString(new File(fileName));
tag = StringUtils.substringBetween(file, First, Last);
return First + tag + Last;
}
It returns me also a "null" value after the string, for example: if I search text between tags <a>
and </a>
it returns <a>null</a>
. The problem is that "tag" as a null value!
The textfile as multiple tags with the same name, each of this including different text: is it possible that the problem is there? And how can I solve it?