public string ParseKeyword(string input, TestTaker.testType tt) { string[] words = input.Split(this.splitSymbols); if (words.Length < 2) { return(input); } StringBuilder output = new StringBuilder(input); foreach (string curWord in words) { if (!curWord.Contains(REPLACE_CHAR) && curWord.Length > 1 && curWord.Contains(TestTaker.KEYWORD_SYMBOL)) { if (tt == TestTaker.testType.kewordsFull) { output.Replace(curWord, fullReplace(curWord)); } else if (tt == TestTaker.testType.keywordsPartial) { output.Replace(curWord, partialReplace(curWord)); } else if (tt == TestTaker.testType.keywordsFirstLetters) { output.Replace(curWord, firstFewLettersOnly(curWord)); } else { output.Replace(curWord, "ERROR 101"); } } } return(output.ToString()); }
public Question(string question, string _answer, TestTaker.testType tt) { answer = _answer; switch (tt) { case TestTaker.testType.kewordsFull: case TestTaker.testType.keywordsPartial: case TestTaker.testType.keywordsFirstLetters: processedQuestion = $"{question}\n\n{ParseKeyword(_answer, tt)}"; break; case TestTaker.testType.fullRandom: default: processedQuestion = $"{question}\n\n{ParseFullRandom(_answer)}"; break; } IsReviewQuestion = false; }