© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
15 replies
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")
}
string msgWithBadWords;
foreach (string word in badList)
{
    msgWithBadWords = msgWithBadWords.ToLower().Replace(word, "bad")
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ change word in english to her original state
C#CC# / help
3y ago
✅ Repeated Letters
C#CC# / help
3y ago
✅ Reorder letters in a string and group per...
C#CC# / help
4y ago