Path.TrimEndingDirectorySeparator Method

Definition

Overloads

TrimEndingDirectorySeparator(ReadOnlySpan<Char>)

Trims one trailing directory separator beyond the root of the specified path.

TrimEndingDirectorySeparator(String)

Trims one trailing directory separator beyond the root of the specified path.

TrimEndingDirectorySeparator(ReadOnlySpan<Char>)

Source:
Path.cs
Source:
Path.cs
Source:
Path.cs

Trims one trailing directory separator beyond the root of the specified path.

C#
public static ReadOnlySpan<char> TrimEndingDirectorySeparator(ReadOnlySpan<char> path);

Parameters

path
ReadOnlySpan<Char>

The path to trim.

Returns

The path without any trailing directory separators.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10

TrimEndingDirectorySeparator(String)

Source:
Path.cs
Source:
Path.cs
Source:
Path.cs

Trims one trailing directory separator beyond the root of the specified path.

C#
public static string TrimEndingDirectorySeparator(string path);

Parameters

path
String

The path to trim.

Returns

The path without any trailing directory separators.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10