'How to split String List to sub String list in Java?
i use Selenium to get some Lecture information what i listen now
and i stored it to List<String> list as String
There is a list of lectures that I am currently listening to,
but each lecture has different information that contains the form of the lecture.
These are the two forms below.
Lecture Number: 1,
Categorization: Online,
Lecture Name: 2. Preparation for learning algorithms 1,
Learning status: full,
Study time / class date: 30 minutes,
Attendance information (within the period): TOTAL: 30 minutes 33 seconds
web 30 minutes 33 seconds
mobile 0 seconds,
Attendance information (after the period): TOTAL: 0 seconds,
web 0 seconds,
mobile 0 seconds,
Lecture number: 1
Categorization: Offline
Lecture Name: Subject Introduction - What is Data?
Learning Status: -
Learning time/class date: 2022-03-02
Attendance information (within the period) Attendance information (after the period): not processed
To learn: a teaching plan
after store that into List<String> list
and when i use this
for(String text: list)
{
System.out.println(text);
}
The results are as follows:
1,
Online
2. Preparation for learning algorithms 1,
full
30 minutes
TOTAL 30
minutes 33 seconds
web 30 minutes 33 seconds
mobile 0 seconds
TOTAL: 0 seconds
web 0 seconds
mobile 0 seconds
1
Offline
Subject Introduction - What is Data?
-
2022-03-02not processed
a teaching plan
How can i store two forms of lecture in different List?
The goal is to put it into the database
but before that i want to seperate into different List
Solution 1:[1]
You should create an object Lecture, for example:
class Lecture {
private int number;
private String categorization;
// omitted
}
Then parse field by field.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Huka |
