Jonathan Allen
Jonathan Allen

Reputation: 70327

How do I tell if a character is an 'e' in C#?

What I'm looking for is not just a 'e' or 'E', but also any e with accident characters.

Upvotes: 0

Views: 69

Answers (2)

Deduplicator
Deduplicator

Reputation: 45674

The probably best way to go is:

  1. Move it to NFKD (Normalization Form Compatibility Decomposition)
  2. Filter all the combining characters out.
  3. Test whether you have just e or E left.

MSDN reference for string.Normalize(System.Text.NormalizationForm.FormKD)

Upvotes: 5

zmbq
zmbq

Reputation: 39023

You'll have to make a list of all the possible Es. Thankfully, they all have more or less the same title: 'Latin Capital Letter E', 'Latin Capital Letter E with Acute', 'Latin Small Letter E', etc...

So, use your favorite search engine to look for Unicode 'Latin Capital Letter E' and Unicode 'Latin Small Letter E' and go over the search results to compile your list.

Upvotes: 1

Related Questions