So I saw Jon's skeet video and there was a code sample :
There should have been a problem with the é
- after reversing but I guess it fails on .net2 (IMHO), anyway it did work for me and I did see the correct reversed string.
char[] a="Les Misérables".ToCharArray();
Array.Reverse(a);
string n= new string(a);
Console.WriteLine (n); //selbarésiM seL
But I took it further:
In Hebrew there is the "Alef" char : ?
and I can add punctuation like : ??
( which I believe consists of 2 chars - yet displayed as one.)
But now look what happens :
char[] a="Les Mis??rables".ToCharArray();
Array.Reverse(a);
string n= new string(a);
Console.WriteLine (n); //selbar??siM seL
There was a split...
I can understand why it is happening :
Console.WriteLine ("??".Length); //2
So I was wondering if there's a workaround for this kind of issue in C# ( or should I build my own mechanism....)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…