/// <summary> /// Removes all trailing white-space characters from the memory. /// </summary> /// <param name="memory">The source memory from which the characters are removed.</param> public static Memory <char> TrimEnd(this Memory <char> memory) => memory.Slice(0, ClampEnd(memory.Span, 0));
/// <summary> /// Removes all trailing occurrences of a specified element from the memory. /// </summary> /// <param name="memory">The source memory from which the element is removed.</param> /// <param name="trimElement">The specified element to look for and remove.</param> public static Memory <T> TrimEnd <T>(this Memory <T> memory, T trimElement) where T : IEquatable <T> => memory.Slice(0, ClampEnd(memory.Span, 0, trimElement));
/// <summary> /// Removes all leading white-space characters from the memory. /// </summary> /// <param name="memory">The source memory from which the characters are removed.</param> public static Memory <char> TrimStart(this Memory <char> memory) => memory.Slice(ClampStart(memory.Span));
/// <summary> /// Removes all leading occurrences of a specified element from the memory. /// </summary> /// <param name="memory">The source memory from which the element is removed.</param> /// <param name="trimElement">The specified element to look for and remove.</param> public static Memory <T> TrimStart <T>(this Memory <T> memory, T trimElement) where T : IEquatable <T> => memory.Slice(ClampStart(memory.Span, trimElement));