| 12345678910111213141516171819202122232425 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace GreenTree.Maschinenbestellungen.Core.Extension
- {
- public static class StringExtension
- {
- /// <summary>
- /// Évaluates a string between a starting and an endling string part
- /// </summary>
- /// <param name="str">Base string.</param>
- /// <param name="start">Beginning string part.</param>
- /// <param name="end">Ending string part.</param>
- public static string Between(this string str, string start, string end)
- {
- var startIndex = str.IndexOf(start) + start.Length;
- var endIndex = str.IndexOf(end, startIndex);
- return end == String.Empty
- ? str.Substring(startIndex)
- : str[startIndex..endIndex];
- }
- }
- }
|