2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Testing string approaches

This commit is contained in:
2021-12-17 22:42:46 +00:00
parent 3e8e4a6319
commit 4287c342a1
2 changed files with 51 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
@@ -206,5 +207,15 @@ namespace Raylib_cs
return byteArray;
}
public static unsafe string GetUTF8String(byte* bytes)
{
return Marshal.PtrToStringUTF8((IntPtr)bytes);
}
public static byte[] GetUTF8Bytes(this string text)
{
return Encoding.UTF8.GetBytes(text);
}
}
}