17 lines
473 B
C#
Raw Normal View History

2024-07-26 09:14:46 +02:00
namespace Utils
{
public static class Str
{
public static string Between(string input, string open, string close)
{
2025-04-25 16:13:01 +02:00
var openI = input.IndexOf(open);
if (openI == -1) return input;
var openIndex = openI + open.Length;
2024-07-26 09:14:46 +02:00
var closeIndex = input.LastIndexOf(close);
2025-04-25 16:13:01 +02:00
if (closeIndex == -1) return input;
2024-07-26 09:14:46 +02:00
return input.Substring(openIndex, closeIndex - openIndex);
}
}
}