Removing diacritics from FString in C++ to improve game experience

I’m working on game where we have lot of items and we have for players option to filter by typing the name. That’s simple until you localize the game. In Slavic languages we have more letters - č á ů etc… if you translate the game the items will correctly have those letters. But many people (including me) are lazy and they type without the diacritics. To have good user experience you want player to be able to type ‘c’ and get all texts that includes ‘c’ and ‘č’.

I didn’t found anywhere such a function for UE so I wrote my own based on C++ sample that I found at stackoverflow.com. I’m sure I’m missing some letters so if somebody will check it and maybe add letters for his langugage?

FString UReviveLibrary::withoutDiacriticsString(FString text) {
	TCHAR* ch = text.GetCharArray().GetData();
	const FString convs = FString("AAAAAAECEEEEIIIIDNOOOOOx0UUUUYPsaaaaaaeceeeeiiiiOnooooo/0uuuuypy             Cc            Ee                                 Ll        Nn               Rr      Ss  Tt         u             Zz");
	const uint32 min = 192;
	const uint32 max = 192 + (uint32)convs.Len();

	for (int ci=0; ci< text.Len(); ci++)  {
		uint32 c = ch[ci];
		if (c >= min && c < max)
			ch[ci] = convs[c - min];
	}

	return FString(ch); 
}

NOTE: I’m not good at UE C++ so maybe there is simpler way to do conversion of FString to char array or it’s maybe not nescessary… but this works ok.