Wczytaj nazwę pliku z konsoli.
Plik zawiera słowa oddzielone znakami interpunkcyjnymi.
Wyprowadź do konsoli liczbę wystąpień słowa "świat" w pliku.
Zamknij strumienie.
Liczenie słów
- 20
Zablokowane
Komentarze (3)
- Popularne
- Nowe
- Najstarsze
Musisz być zalogowany aby dodać komentarz
Krystian
3 października 2023, 19:03
String [] strings = sb.toString().split("[\\s.!?\\-()]");
0
DolMaciek
22 kwietnia 2021, 17:26
String replacedString = text.toString().replaceAll("\\p{P}", " ").replaceAll("\\s", " ");
Maybe that's a stupid question but can anyone help me with understanding this line?
I understand we taking a StringBuilder object and we using a method .toString() after that we replacing something for a spaces, but i don't really understand what's going to be replaced.
0
Roman
23 kwietnia 2021, 06:09
Read about the regular expressions)
0