我看起来像这样的的Java格式化的ArrayList
[netl, entl, ltc, 6.3, 6.3, maat, lo, CombiGym, mr, wisB, nat, schk, biol, 6.4, 6.4, wisD, L&W, 9, 8.5, reken, exp]
我希望它看起来像这样
[netl, entl, ltc 6.3 6.3, maat, lo, CombiGym, mr, wisB, nat, schk, biol 6.4 6.4, wisD, L&W 9 8.5, reken, exp]
我不想的数字是在ArrayList的一个单独的对象的ArrayList。 这是我的代码
ArrayList<String> arrayvakken = new ArrayList<String>();
String loginFormUrl = "https://werkers.wpkeesboeke.nl/login?path=%2F%3F";
String loginActionUrl = "https://werkers.wpkeesboeke.nl/login?passAction=login&path=%2F%3F";
String username = "USERNAME";
String password = "PASSWORD";
HashMap<String, String> cookies = new HashMap<>();
HashMap<String, String> formData = new HashMap<>();
Connection.Response loginForm = Jsoup.connect(loginFormUrl).method(Connection.Method.GET).userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0").execute();
Document loginDoc = loginForm.parse(); // this is the document that contains response html
cookies.putAll(loginForm.cookies()); // save the cookies, this will be passed on to next request
formData.put("Login", "Inloggen");
formData.put("wu_loginname", username);
formData.put("wu_password", password);
Connection.Response homePage = Jsoup.connect(loginActionUrl)
.cookies(cookies)
.data(formData)
.userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0")
.method(Connection.Method.POST)
.execute();
Document document2 = Jsoup.connect("https://werkers.wpkeesboeke.nl/Portaal/Cijfer_menu/Cijferoverzicht").cookies(cookies).get();
for(Element element : document2.select(".vak,.wp3-cijfer")) {
arrayvakken.add(element.select(".vak,.wp3-cijfer").text());
}
for(String str : arrayvakken) {
Pattern p = Pattern.compile("([0-9])");
Matcher m = p.matcher(str);
if(m.find()){
System.out.println("number");
} else {
System.out.println("word");
}
}
}
我如何格式化ArrayList,如上图所示?
是什么代码都和这两个阵列的呢? –
列表中的类型是什么? –
字符串,我使用Jsoup从网站获取数据 – Ropro