I would like to use the this method to create a user-friendly URL. Since my site is in Croatian, there are characters that I would not want to shoot, but replaced them with another. For example, this line:
ŠĐĆŽ šđčćž
should be: sdccz-sdccz
So, I would like to create two arrays, one of which will contain the characters that should be replaced, and the other array with replacement characters:
string[] character = { "Š", "Đ", "Č", "Ć", "Ž", "š", "đ", "č", "ć", "ž" }; string[] characterReplace = { "s", "d", "c", "c", "z", "s", "d", "c", "c", "z" };
Finally, these two arrays should be used in some method that will take a string, find matches, and replace them. In php, I used the preg_replace function to handle this. In C #, this does not work:
s = Regex.Replace(s, character, characterReplace);
I would be grateful if someone could help. Thanks