correction in the add method of Text.java

This commit is contained in:
schrom01 2021-11-12 19:54:29 +01:00
parent d2361e870b
commit 6ba8ab23af
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ public class Text {
*/
public boolean add(int paragraphNumber, String newText) {
if (paragraphExists(paragraphNumber)) {
text.add((paragraphNumber - 1), newText);
text.add((paragraphNumber - 1), newText.replaceAll("[^A-Za-z0-9 .,:?!\"'-]", ""));
return true;
}
return false;
@ -164,7 +164,7 @@ public class Text {
/**
* This method counts all words in text and adds the count together with the paragraph where the word has been used to a Hashmap.
*
* @param wordbook
* @param wordbook the HashMap Object which should be edited
*/
private void createWordlist(HashMap<String, ArrayList<Integer>> wordbook) {
ArrayList<Integer> numbersList;