Method RemovePrefix
RemovePrefix(string?, string?, StringComparison)
Removes the specified prefix from the beginning of the input string, if present. Supports case-sensitive or case-insensitive comparisons using StringComparison.
public static string? RemovePrefix(string? input, string? prefix, StringComparison comparison = StringComparison.CurrentCulture)
Parameters
inputstringThe input string to evaluate.
prefixstringThe prefix to remove from
input.comparisonStringComparisonThe string comparison mode used for prefix matching.
Returns
- string
The input string without the prefix if it matched; otherwise, the original input. Returns
nullifinputisnull.