Skip to content

BeforeLast Method ​

Definition ​

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

ReadOnlySpan<char> BeforeLast(string input, char value) ​

csharp
ReadOnlySpan<char> BeforeLast(string input, char value)

Returns the slice of input preceding the last occurrence of value as a ReadOnlySpan1over the original string, so no new string is allocated. Returns an empty span whenvalueis the first character or is not present, matchingSystem.IO.Path.GetDirectoryName(System.String)semantics for a bare name. Call.ToString()` on the result only when a materialized string is actually required.