mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-30 04:54:20 +01:00
19 lines
491 B
C#
19 lines
491 B
C#
|
using System.Text;
|
|||
|
|
|||
|
namespace HidLibrary
|
|||
|
{
|
|||
|
public static class Extensions
|
|||
|
{
|
|||
|
public static string ToUTF8String(this byte[] buffer)
|
|||
|
{
|
|||
|
var value = Encoding.UTF8.GetString(buffer);
|
|||
|
return value.Remove(value.IndexOf((char)0));
|
|||
|
}
|
|||
|
|
|||
|
public static string ToUTF16String(this byte[] buffer)
|
|||
|
{
|
|||
|
var value = Encoding.Unicode.GetString(buffer);
|
|||
|
return value.Remove(value.IndexOf((char)0));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|