Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#β€’2y agoβ€’
7 replies
πŸŒ·πŸ’ morgan πŸŒΊπŸ’

Better way to check a list of characters?

There has to be a better way than doing this
myWord == "-" || myWord == "~" || myWord == "β€”"...
myWord == "-" || myWord == "~" || myWord == "β€”"...

I also don't really want to make a array and have to loop through them all because that seems like code would pile up quickly. I'm hoping for a function that does what I'm looking for?
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

βœ… How to check whether a given list is present in the List of list
C#CC# / help
4y ago
❔ Better way of handling this?
C#CC# / help
4y ago
❔ Better way to check 2 dictionaries against one another?
C#CC# / help
3y ago