C#C
C#3y ago
Moataz

❔ 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")
}
Was this page helpful?