So I have an input file of the form:
AdjGraphHeader
11
20
30
.
.
.
and I need to create a string array that holds each line separately. So I read the file using:
String s = FileUtils.readFileToString(f);
Words w = new Words(s, (long)s.length());
and then the words constructor did the following:
public Words(String str, long n_) {
strings = str.split("\\n");
string = str;
n = n_;
m = strings.length;
}
The issue seems to be that there is an extra line at the end of adjGraphHeader
, but I have no idea how to get rid of it. Any help would be greatly appreciated.