C
C#3y ago
Bujju

Sort items in list to most similar to a specific string [Answered]

How can I sort items in a List<string> by similarity to a certain string?
3 Replies
TheBoxyBear
TheBoxyBear3y ago
You have to start by defining similarity. I would do it as a method that returns a number based on how similar. Then you can simply use OrderBy and pass the similarity method
Bujju
BujjuOP3y ago
Thanks, I’ll use string.Compare()
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server