-2

So I want to make a method where it checks the string a user has put in and it compares the string to the ones in the list the comparison has to be done with ASCII while also checking if there are special characters that needs to be changed like a é -> e. Now my question is how is the best method to do so?

Just for info purposes i'm quite new to C#(only three weeks in).

  • 3
    we like to see effort first, but try to make dictionary of your changes/substitutions – kenny Nov 03 '19 at 13:39
  • Thank you for taking the time to share your problem. But there is something missing from your question. What is your goal and your difficulty? What have you done so far? Please try to better explain your issue, your development environment and the data structures, as well as to share more code (no screenshot), some samples, images or sketches of the screen, and user stories or scenario diagrams. To help you improve your requests, please read the *[How do I ask a good question](https://stackoverflow.com/help/how-to-ask)* and **Questions I avoid asking** at the top right. –  Nov 03 '19 at 13:43
  • 1
    Possible duplicate of [How do I remove diacritics (accents) from a string in .NET?](https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net) –  Nov 03 '19 at 13:45
  • Further, explain your problem and maybe we can help. – tobeypeters Nov 03 '19 at 13:45
  • Seems like you want to `remove the diacritics` and then see if a string is in a `Dictionary`, or a `List`. – Tony Nov 03 '19 at 13:52

1 Answers1

1

Maybe this will get you started, this example can be copied and executed...

using System.Collections.Generic;
using System.Linq;

List<string> stringList = new List<string>() {"f","o","o","b","a","r"};
    string givenString = "á";
    List<string> resultList = stringList.Where(item=> item.Contains(givenString.Replace('á', 'a'))).ToList();

foreach (var value in resultList) {
    Console.WriteLine(value);
}
otto
  • 190
  • 1
  • 7
  • It doesn't matter much. But, if you're just looking for characters, I'd use a List; Anyhow, I like your approach. – tobeypeters Nov 03 '19 at 15:59