Reputation: 11190
I would like to replace the french letter Æ with the asci corresponding AE, but the method does not accept this. Is there another way?
Upvotes: 1
Views: 15503
Reputation: 2032
This doesn't work?
string x = "ÆHELLO";
string y = x.Replace("Æ", "AE");
Upvotes: 4
Reputation: 161002
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"
Upvotes: 2
Reputation: 10377
Instead of string.Replace('Æ','AE')
, use string.Replace("Æ", "AE")
.
Upvotes: 4
Reputation: 32343
Just call .ToString()
on your char:
var str = str.Replace('Æ'.ToString(), "AE");
Upvotes: 3