Distinguishing between Japanese number formats
.net, string, string-comparison
Solution
fileformat.info tells me that circled digits can be decomposed into regular digits. Poking at this in ideone shows that the normalization forms that will achieve that in .NET are KC or KD:
var one = "①";
Console.WriteLine(one);
Console.WriteLine(one.Normalize(NormalizationForm.FormC)); // ①
Console.WriteLine(one.Normalize(NormalizationForm.FormD)); // ①
Console.WriteLine(one.Normalize(NormalizationForm.FormKC)); // 1
Console.WriteLine(one.Normalize(NormalizationForm.FormKD)); // 1
That said, there is a caveat in that normalizing a string might also mangle other characters you want to remain as-is.
Problem
In .NET, I need (if possible) to distinguish between different types of Japanese number strings. In Japanese number strings can be written in different ways, e.g for `"1"` there is `"1"`, `"ⅰ"`, `"Ⅰ"`, `"①"` in half-width characters. I need to compare strings like `"MyString1"` and `"MyString①"`, and for obvious reasons they are not equal. I am wondering if there is a way to automatically change `"①"` type characters to `"1"` automatically? EDIT I know that the obvious answer would be to make a list of all possible "①" type characters (there is a finite number of those) and replace them in the target string. But that's not a very "nice" way of going about this in my opinion, nor is it very robust... so if there is a generic way I'd much rather use that. EDIT Apologies, I previously wrote that bot `"①"` and `"1"` are considered numbers, but they are not. IsNumeric `"①"` comes up as false. So I guess there might actually be no way at all to switch from one to the other apart from using a straight substitution.