From 6ba8ab23af052d3a65fe9e1d5d0b3a88ffe73b32 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 12 Nov 2021 19:54:29 +0100 Subject: [PATCH] correction in the add method of Text.java --- src/Text.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Text.java b/src/Text.java index df37cb9..ad66600 100644 --- a/src/Text.java +++ b/src/Text.java @@ -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> wordbook) { ArrayList numbersList;