开发者

String.Replace char to string

I would like to 开发者_Go百科replace the french letter Æ with the asci corresponding AE, but the method does not accept this. Is there another way?


How about:

myString.Replace("Æ", "AE");


Instead of string.Replace('Æ','AE'), use string.Replace("Æ", "AE").


This doesn't work?

string x = "ÆHELLO";
string y = x.Replace("Æ", "AE");


Just call .ToString() on your char:

var str = str.Replace('Æ'.ToString(), "AE");


This should work since it is a valid Unicode character - are you sure you are re-assigning the string? strings are immutable so this is necessary:

string test = "Æblah";
test = test.Replace("Æ", "AE");//test is now "AEblah"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜