Testing string approaches
This commit is contained in:
parent
3e8e4a6319
commit
4287c342a1
2 changed files with 51 additions and 38 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue