Beispiel #1
0
        private void DoDeleteWordInBrackets(Word word)
        {
            var regex = new Regex(@"\(.*\)");

            word.BaseWord = regex.Replace(word.BaseWord, string.Empty);
            word.Translation = regex.Replace(word.Translation, string.Empty);
        }
Beispiel #2
0
        public void NoDeleteBracketsAndNoDeleteLinesTest()
        {
            WordCleaner.DeleteWordInBrackets = false;
            WordCleaner.DeleteLines = false;

            var testString = "a_(_)_";
            var testWord = new Word { Translation = testString, BaseWord = testString };
            cleaner.Clean(testWord);

            Assert.AreEqual("a_(_)_", testWord.BaseWord);
            Assert.AreEqual("a_(_)_", testWord.Translation);
        }
Beispiel #3
0
        public void Clean(Word word)
        {
            if(DeleteLines)
            {
                DoDeleteLines(word);
            }

            if (DeleteWordInBrackets)
            {
                DoDeleteWordInBrackets(word);
            }
        }
Beispiel #4
0
 private void DoDeleteLines(Word word)
 {
     word.BaseWord = word.BaseWord.Replace("_", " ");
     word.Translation = word.Translation.Replace("_", " ");
 }