-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubstitution.cs
More file actions
17 lines (16 loc) · 899 Bytes
/
Substitution.cs
File metadata and controls
17 lines (16 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace TheElm.Literals {
public static class Substitution {
/// <summary>Trim a length of string from the start of a string</summary>
/// <param name="input"></param>
/// <param name="fromStart"></param>
/// <returns></returns>
public static string TrimStart( this string input, string fromStart )
=> input.StartsWith(fromStart, StringComparison.InvariantCultureIgnoreCase) ? input[fromStart.Length..].TrimStart() : input;
/// <summary>Trim a length of string from the end of a string</summary>
/// <param name="input"></param>
/// <param name="fromEnd"></param>
/// <returns></returns>
public static string TrimEnd( this string input, string fromEnd )
=> input.EndsWith(fromEnd, StringComparison.InvariantCultureIgnoreCase) ? input[..^fromEnd.Length].TrimEnd() : input;
}
}