Method RemovePrefix
RemovePrefix(IEnumerable<string?>, string, StringComparison)
Removes the specified prefix from each string in the sequence, using the given comparison rule.
public static IEnumerable<string?> RemovePrefix(IEnumerable<string?> items, string prefix, StringComparison comparison = StringComparison.CurrentCulture)
Parameters
itemsIEnumerable<string>The collection of strings to process.
prefixstringThe prefix to remove from each string.
comparisonStringComparisonThe StringComparison option to use when matching the prefix. For example, use OrdinalIgnoreCase for case-insensitive matching.
Returns
- IEnumerable<string>
A sequence of strings with the prefix removed where applicable. If an item does not start with the prefix (based on the specified comparison), it is returned unchanged.