# TrimEnd

> Removes whitespace characters from the end of the string.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## TrimEnd\<T>(T)

Removes whitespace characters from the end of the string.

```csharp
public static T TrimEnd<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): A string to perform operation.

### Returns

| Type | Description                                                                                    |
| ---- | ---------------------------------------------------------------------------------------------- |
| T    | Returns instance of this string with whitespace characters removed from the end of the string. |

## TrimEnd(UnsafeText, AllocatorHandle)

Removes whitespace characters from the end of the string.

```csharp
public static UnsafeText TrimEnd(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[UnsafeText]\(/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext)): A [UnsafeText](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext.md) string to perform operation.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The [AllocatorManager.AllocatorHandle](/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle.md) allocator type to use.

### Returns

| Type                                                                                          | Description                                                                                    |
| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [UnsafeText](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext.md) | Returns instance of this string with whitespace characters removed from the end of the string. |

## TrimEnd(NativeText, AllocatorHandle)

Removes whitespace characters from the end of the string.

```csharp
public static NativeText TrimEnd(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[NativeText]\(/engine/6000.7/script-reference/unity/collections/nativetext)): A [NativeText](/engine/6000.7/script-reference/unity/collections/nativetext.md) string to perform operation.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The [AllocatorManager.AllocatorHandle](/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle.md) allocator type to use.

### Returns

| Type                                                                          | Description                                                                                    |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [NativeText](/engine/6000.7/script-reference/unity/collections/nativetext.md) | Returns instance of this string with whitespace characters removed from the end of the string. |

## TrimEnd\<T>(T, ReadOnlySpan\<Rune>)

Removes specific characters from the end of the string.

```csharp
public static T TrimEnd<T>(this ref T fs, ReadOnlySpan<Unicode.Rune> trimRunes) where T : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): A string to perform operation.**** (\[ReadOnlySpan\<Rune>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): Runes that should be trimmed.

### Returns

| Type | Description                                                                                  |
| ---- | -------------------------------------------------------------------------------------------- |
| T    | Returns instance of this string with specific characters removed from the end of the string. |

## TrimEnd(UnsafeText, AllocatorHandle, ReadOnlySpan\<Rune>)

Removes specific characters from the end of the string.

```csharp
public static UnsafeText TrimEnd(this ref UnsafeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
```

### Parameters

**** (\[UnsafeText]\(/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext)): A [UnsafeText](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext.md) string to perform operation.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The [AllocatorManager.AllocatorHandle](/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle.md) allocator type to use.**** (\[ReadOnlySpan\<Rune>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): Runes that should be trimmed.

### Returns

| Type                                                                                          | Description                                                                                  |
| --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [UnsafeText](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafetext.md) | Returns instance of this string with specific characters removed from the end of the string. |

## TrimEnd(NativeText, AllocatorHandle, ReadOnlySpan\<Rune>)

Removes specific characters from the end of the string.

```csharp
public static NativeText TrimEnd(this ref NativeText fs, AllocatorManager.AllocatorHandle allocator, ReadOnlySpan<Unicode.Rune> trimRunes)
```

### Parameters

**** (\[NativeText]\(/engine/6000.7/script-reference/unity/collections/nativetext)): A [NativeText](/engine/6000.7/script-reference/unity/collections/nativetext.md) string to perform operation.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The [AllocatorManager.AllocatorHandle](/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle.md) allocator type to use.**** (\[ReadOnlySpan\<Rune>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): Runes that should be trimmed.

### Returns

| Type                                                                          | Description                                                                                  |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [NativeText](/engine/6000.7/script-reference/unity/collections/nativetext.md) | Returns instance of this string with specific characters removed from the end of the string. |
