MemoryExtensions.Trim MemoryExtensions.Trim MemoryExtensions.Trim MemoryExtensions.Trim Method

定义

重载

Trim(Memory<Char>) Trim(Memory<Char>) Trim(Memory<Char>) Trim(Memory<Char>)

删除字符内存区域中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a character memory region.

Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>)

删除只读字符内存区域中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a read-only character memory region.

Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>)

删除只读字符跨度中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a read-only character span.

Trim(Span<Char>) Trim(Span<Char>) Trim(Span<Char>) Trim(Span<Char>)

删除字符跨度中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a character span.

Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char)

删除只读字符跨度中的指定字符的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified character from a read-only character span.

Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

从只读字符跨度中删除在只读跨度中指定的一组字符的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a read-only character span.

Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>)

从跨度中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a span.

Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T)

删除只读跨度中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a read-only span.

Trim<T>(Span<T>, T) Trim<T>(Span<T>, T) Trim<T>(Span<T>, T) Trim<T>(Span<T>, T)

删除跨度中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a span.

Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

从只读跨度中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a read-only span.

Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T)

删除只读内存区域中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a read-only memory region.

Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>)

从只读内存区域中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a read-only memory region.

Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T)

删除内存区域中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a memory region.

Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>)

从内存区域中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a memory region.

Trim(Memory<Char>) Trim(Memory<Char>) Trim(Memory<Char>) Trim(Memory<Char>)

删除字符内存区域中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a character memory region.

public:
[System::Runtime::CompilerServices::Extension]
 static Memory<char> Trim(Memory<char> memory);
public static Memory<char> Trim (this Memory<char> memory);
static member Trim : Memory<char> -> Memory<char>
<Extension()>
Public Function Trim (memory As Memory(Of Char)) As Memory(Of Char)

参数

memory
Memory<Char>

从中删除字符的源内存。The source memory from which the characters are removed.

返回

剪裁后的字符内存区域。The trimmed character memory region.

Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>) Trim(ReadOnlyMemory<Char>)

删除只读字符内存区域中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a read-only character memory region.

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<char> Trim(ReadOnlyMemory<char> memory);
public static ReadOnlyMemory<char> Trim (this ReadOnlyMemory<char> memory);
static member Trim : ReadOnlyMemory<char> -> ReadOnlyMemory<char>
<Extension()>
Public Function Trim (memory As ReadOnlyMemory(Of Char)) As ReadOnlyMemory(Of Char)

参数

memory
ReadOnlyMemory<Char>

从中删除字符的源内存。The source memory from which the characters are removed.

返回

剪裁后的字符内存区域。The trimmed character memory region.

Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>)

删除只读字符跨度中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a read-only character span.

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span);
public static ReadOnlySpan<char> Trim (this ReadOnlySpan<char> span);
static member Trim : ReadOnlySpan<char> -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char)) As ReadOnlySpan(Of Char)

参数

span
ReadOnlySpan<Char>

从中删除字符的源跨度。The source span from which the characters are removed.

返回

剪裁后的只读字符范围。The trimmed read-only character span.

Trim(Span<Char>) Trim(Span<Char>) Trim(Span<Char>) Trim(Span<Char>)

删除字符跨度中的所有前导和尾随空格字符。Removes all leading and trailing whitespace characters from a character span.

public:
[System::Runtime::CompilerServices::Extension]
 static Span<char> Trim(Span<char> span);
public static Span<char> Trim (this Span<char> span);
static member Trim : Span<char> -> Span<char>
<Extension()>
Public Function Trim (span As Span(Of Char)) As Span(Of Char)

参数

span
Span<Char>

从中删除字符的源跨度。The source span from which the characters are removed.

返回

剪裁后的字符范围。The trimmed character span.

Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char) Trim(ReadOnlySpan<Char>, Char)

删除只读字符跨度中的指定字符的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified character from a read-only character span.

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span, char trimChar);
public static ReadOnlySpan<char> Trim (this ReadOnlySpan<char> span, char trimChar);
static member Trim : ReadOnlySpan<char> * char -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char), trimChar As Char) As ReadOnlySpan(Of Char)

参数

span
ReadOnlySpan<Char>

从中删除字符的源跨度。The source span from which the character is removed.

trimChar
Char Char Char Char

要查找和删除的指定字符。The specified character to look for and remove.

返回

剪裁后的只读字符范围。The trimmed read-only character span.

Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>) Trim(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

从只读字符跨度中删除在只读跨度中指定的一组字符的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of characters specified in a read-only span from a read-only character span.

public:
[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<char> Trim(ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars);
public static ReadOnlySpan<char> Trim (this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars);
static member Trim : ReadOnlySpan<char> * ReadOnlySpan<char> -> ReadOnlySpan<char>
<Extension()>
Public Function Trim (span As ReadOnlySpan(Of Char), trimChars As ReadOnlySpan(Of Char)) As ReadOnlySpan(Of Char)

参数

span
ReadOnlySpan<Char>

从中删除字符的源跨度。The source span from which the characters are removed.

trimChars
ReadOnlySpan<Char>

包含要删除的字符集的跨度。The span which contains the set of characters to remove.

返回

剪裁后的只读字符范围。The trimmed read-only character span.

注解

如果trimChars为空, 则改为移除空白字符。If trimChars is empty, whitespace characters are removed instead.

Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>) Trim<T>(Span<T>, ReadOnlySpan<T>)

从跨度中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static Span<T> Trim(Span<T> span, ReadOnlySpan<T> trimElements);
public static Span<T> Trim<T> (this Span<T> span, ReadOnlySpan<T> trimElements) where T : IEquatable<T>;
static member Trim : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> Span<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (span As Span(Of T), trimElements As ReadOnlySpan(Of T)) As Span(Of T)

类型参数

T

范围中元素的类型。The type of the elements in the span.

参数

span
Span<T> Span<T> Span<T> Span<T>

从中删除元素的源跨度。The source span from which the elements are removed.

trimElements
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

包含要删除的元素集的跨度。The span which contains the set of elements to remove.

返回

剪裁后的范围。The trimmed span.

注解

如果trimElements为空, 则返回未修改的范围。If trimElements is empty, the span is returned unaltered.

Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T) Trim<T>(ReadOnlySpan<T>, T)

删除只读跨度中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a read-only span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<T> Trim(ReadOnlySpan<T> span, T trimElement);
public static ReadOnlySpan<T> Trim<T> (this ReadOnlySpan<T> span, T trimElement) where T : IEquatable<T>;
static member Trim : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), trimElement As T) As ReadOnlySpan(Of T)

类型参数

T

只读范围中元素的类型。The type of the elements in the read-only span.

参数

span
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

从中删除元素的源跨度。The source span from which the element is removed.

trimElement

要查找和删除的指定元素。The specified element to look for and remove.

返回

剪裁后的只读范围。The trimmed read-only span.

Trim<T>(Span<T>, T) Trim<T>(Span<T>, T) Trim<T>(Span<T>, T) Trim<T>(Span<T>, T)

删除跨度中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static Span<T> Trim(Span<T> span, T trimElement);
public static Span<T> Trim<T> (this Span<T> span, T trimElement) where T : IEquatable<T>;
static member Trim : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> Span<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (span As Span(Of T), trimElement As T) As Span(Of T)

类型参数

T

范围中元素的类型。The type of the elements in the span.

参数

span
Span<T> Span<T> Span<T> Span<T>

从中删除元素的源跨度。The source span from which the element is removed.

trimElement

要查找和删除的指定元素。The specified element to look for and remove.

返回

剪裁后的范围。The trimmed span.

Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

从只读跨度中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a read-only span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static ReadOnlySpan<T> Trim(ReadOnlySpan<T> span, ReadOnlySpan<T> trimElements);
public static ReadOnlySpan<T> Trim<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> trimElements) where T : IEquatable<T>;
static member Trim : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), trimElements As ReadOnlySpan(Of T)) As ReadOnlySpan(Of T)

类型参数

T

只读范围中元素的类型。The type of the elements in the read-only span.

参数

span
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

从中删除元素的源跨度。The source span from which the elements are removed.

trimElements
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

包含要删除的元素集的跨度。The span which contains the set of elements to remove.

返回

剪裁后的只读范围。The trimmed read-only span.

注解

如果trimElements为空, 则返回未修改的范围。If trimElements is empty, the span is returned unaltered.

Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T) Trim<T>(ReadOnlyMemory<T>, T)

删除只读内存区域中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a read-only memory region.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<T> Trim(ReadOnlyMemory<T> memory, T trimElement);
public static ReadOnlyMemory<T> Trim<T> (this ReadOnlyMemory<T> memory, T trimElement) where T : IEquatable<T>;
static member Trim : ReadOnlyMemory<'T (requires 'T :> IEquatable<'T>)> * 'T -> ReadOnlyMemory<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (memory As ReadOnlyMemory(Of T), trimElement As T) As ReadOnlyMemory(Of T)

类型参数

T

只读内存区域中的元素的类型。The type of the elements in the read-only memory region.

参数

memory
ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T>

从中删除元素的源内存。The source memory from which the element is removed.

trimElement

要查找和删除的指定元素。The specified element to look for and remove.

返回

剪裁后的只读内存区域。The trimmed read-only memory region.

Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>) Trim<T>(ReadOnlyMemory<T>, ReadOnlySpan<T>)

从只读内存区域中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a read-only memory region.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static ReadOnlyMemory<T> Trim(ReadOnlyMemory<T> memory, ReadOnlySpan<T> trimElements);
public static ReadOnlyMemory<T> Trim<T> (this ReadOnlyMemory<T> memory, ReadOnlySpan<T> trimElements) where T : IEquatable<T>;
static member Trim : ReadOnlyMemory<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> ReadOnlyMemory<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (memory As ReadOnlyMemory(Of T), trimElements As ReadOnlySpan(Of T)) As ReadOnlyMemory(Of T)

类型参数

T

只读内存区域中的元素的类型。The type of the elements in the read-only memory region.

参数

memory
ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T> ReadOnlyMemory<T>

从中删除元素的源内存。The source memory from which the elements are removed.

trimElements
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

包含要删除的元素集的跨度。The span which contains the set of elements to remove.

返回

剪裁后的只读内存区域。The trimmed read-only memory region.

注解

如果trimElements为空, 则返回未修改的内存。If trimElements is empty, the memory is returned unaltered.

Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T) Trim<T>(Memory<T>, T)

删除内存区域中的指定元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a specified element from a memory region.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static Memory<T> Trim(Memory<T> memory, T trimElement);
public static Memory<T> Trim<T> (this Memory<T> memory, T trimElement) where T : IEquatable<T>;
static member Trim : Memory<'T (requires 'T :> IEquatable<'T>)> * 'T -> Memory<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (memory As Memory(Of T), trimElement As T) As Memory(Of T)

类型参数

T

内存区域中的元素的类型。The type of the elements in the memory region.

参数

memory
Memory<T> Memory<T> Memory<T> Memory<T>

从中删除元素的源内存。The source memory from which the element is removed.

trimElement

要查找和删除的指定元素。The specified element to look for and remove.

返回

剪裁后的内存区域。The trimmed memory region.

Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>) Trim<T>(Memory<T>, ReadOnlySpan<T>)

从内存区域中删除在只读跨度中指定的一组元素的所有前导和尾随出现次数。Removes all leading and trailing occurrences of a set of elements specified in a read-only span from a memory region.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static Memory<T> Trim(Memory<T> memory, ReadOnlySpan<T> trimElements);
public static Memory<T> Trim<T> (this Memory<T> memory, ReadOnlySpan<T> trimElements) where T : IEquatable<T>;
static member Trim : Memory<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> Memory<'T (requires 'T :> IEquatable<'T>)> (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function Trim(Of T As IEquatable(Of T)) (memory As Memory(Of T), trimElements As ReadOnlySpan(Of T)) As Memory(Of T)

类型参数

T

内存区域中的元素的类型。The type of the elements in the memory region.

参数

memory
Memory<T> Memory<T> Memory<T> Memory<T>

从中删除元素的源内存。The source memory from which the elements are removed.

trimElements
ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T> ReadOnlySpan<T>

包含要删除的元素集的跨度。The span which contains the set of elements to remove.

返回

剪裁后的内存区域。The trimmed memory region.

注解

如果trimElements为空, 则返回未修改的内存。If trimElements is empty, the memory is returned unaltered.

适用于