mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-06 04:49:07 +00:00
This is necessary due to issue https://github.com/MyNihongo/MudBlazor.Markdown/issues/247 I created a PR as well: https://github.com/MyNihongo/MudBlazor.Markdown/pull/246
28 lines
526 B
C#
28 lines
526 B
C#
namespace MudBlazor;
|
|
|
|
internal static class StringLineEx
|
|
{
|
|
public static int IndexOf(this StringLine @this, string value, int startIndex = 0)
|
|
{
|
|
const int notFoundIndex = -1;
|
|
|
|
if (@this.Slice.Length < value.Length)
|
|
return notFoundIndex;
|
|
|
|
for (var i = startIndex; i <= @this.Slice.Length - value.Length; i++)
|
|
{
|
|
var j = 0;
|
|
for (; j < value.Length; j++)
|
|
{
|
|
if (@this.Slice[@this.Position + i + j] != value[j])
|
|
break;
|
|
}
|
|
|
|
if (j == value.Length)
|
|
return i;
|
|
}
|
|
|
|
return notFoundIndex;
|
|
}
|
|
}
|