I need to remove a whole few lines and separate a data sheet from a URL to fix what I need to print. What do I need to use?
So far, I have this:
while (input.hasNext()) {
String line = input.nextLine();
//String trimStr = line.trim();
StringTokenizer tokenizer = new StringTokenizer(line, " , ");
int numberOfTokens = tokenizer.countTokens();
String[] splitArr = new String[numberOfTokens];
for (int i=0; i<numberOfTokens; i++)
splitArr[i]=tokenizer.nextToken();
System.out.println(Arrays.toString(splitArr));
I have a whole data list from a URL. How do I remove like 10 lines out of 20 so that is not shown in the output.
Input is the URL site in print view. Expected Output is:
STATION: DENVER, CO MONTH: JUNE YEAR: 2012
Day Min <----(Minimum temperature)
1 59
2 51
3 34
4 26
5 28
6 34
7 42
8 31
9 31
10 37
11 38 etc......
数组不像Java中的“真实”集合那样易变,因此您应该将拆分结果转换为List<String>
并删除不必要的元素。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.