Moataz
Moataz
CC#
Created by Moataz on 10/1/2023 in #help
❔ How to censor a bad word in capital letters without changing original letters case?
I'm trying to loop through a list of bad words to filter them out, but when their case is different I had to use ToLower() which changes the case of original message completely to lower:
string msgWithBadWords;
foreach (string word in badList)
{
msgWithBadWords = msgWithBadWords.ToLower().Replace(word, "bad")
}
string msgWithBadWords;
foreach (string word in badList)
{
msgWithBadWords = msgWithBadWords.ToLower().Replace(word, "bad")
}
16 replies