using System.Runtime.CompilerServices;
namespace NHSE.Core
{
///
/// Logic for manipulating strings
///
public static class StringUtil
{
///
/// Trims a string at the first instance of a 0x0000 terminator.
///
/// String to trim.
/// Trimmed string.
public static string TrimFromZero(string input) => TrimFromFirst(input, '\0');
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string TrimFromFirst(string input, char c)
{
int index = input.IndexOf(c);
return index < 0 ? input : input.Substring(0, index);
}
}
}