Polyfills
using System;
using System.Runtime.CompilerServices;
namespace NJsonSchema
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal static class Polyfills
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool Contains(this string source, char c)
{
return source.IndexOf(c) != -1;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool StartsWith(this string source, char c)
{
if (source.Length > 0)
return source[0] == c;
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool EndsWith(this string s, char c)
{
if (s.Length > 0)
return s[s.Length - 1] == c;
return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool Contains([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})] this ReadOnlySpan<string> source, string c)
{
return source.IndexOf(c) != -1;
}
}
}