1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

properly quote char

This commit is contained in:
EinBurgbauer 2021-12-30 18:06:55 +01:00
parent 6c03b8c8c9
commit ea0a76142a
2 changed files with 8 additions and 2 deletions

View file

@ -1130,7 +1130,10 @@ namespace System.Reflection
strBuffer.Append((*(bool*)&mValue) ? "true" : "false");
case typeof(char8), typeof(char16), typeof(char32):
strBuffer.Append('\'');
(*(char32*)&mValue).ToString(strBuffer);
var str = (*(char32*)&mValue).ToString(.. scope .());
let len = str.Length;
String.QuoteString(&str[0], len, str);
strBuffer.Append(str[(len + 1)...^2]);
strBuffer.Append('\'');
case typeof(uint64), typeof(uint):
(*(uint64*)&mValue).ToString(strBuffer);

View file

@ -1130,7 +1130,10 @@ namespace System.Reflection
strBuffer.Append((*(bool*)&mValue) ? "true" : "false");
case typeof(char8), typeof(char16), typeof(char32):
strBuffer.Append('\'');
(*(char32*)&mValue).ToString(strBuffer);
var str = (*(char32*)&mValue).ToString(.. scope .());
let len = str.Length;
String.QuoteString(&str[0], len, str);
strBuffer.Append(str[(len + 1)...^2]);
strBuffer.Append('\'');
case typeof(uint64), typeof(uint):
(*(uint64*)&mValue).ToString(strBuffer);