Watch
2
0
Fork
You've already forked raylib-cs
0

Testing string approaches

This commit is contained in:
Rgebee 2021-12-17 22:42:46 +00:00
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);
}
}
}