# CopyFromTruncated

> Copies another string to this string. If the string exceeds the capacity it will be truncated. Replaces any existing content of the FixedString.

## Definition

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

## CopyFromTruncated\<T>(T, string)

Copies another string to this string. If the string exceeds the capacity it will be truncated. Replaces any existing content of the FixedString.

```csharp
[ExcludeFromBurstCompatTesting("Takes managed string")]
public static CopyError CopyFromTruncated<T>(this ref T fs, string s) where T : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): The destination string.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The source string.

### Returns

| Type                                                                        | Description                                                                                                             |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |

## CopyFromTruncated\<T, U>(T, T)

Copies another string to this string. If the string exceeds the capacity it will be truncated.

```csharp
public static CopyError CopyFromTruncated<T, T2>(this ref T fs, in T2 input) where T : unmanaged, INativeList<byte>, IUTF8Bytes where T2 : unmanaged, INativeList<byte>, IUTF8Bytes
```

### Parameters

**** (T): The destination string.**** (T): The source string.

### Returns

| Type                                                                        | Description                                                                                                             |
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [CopyError](/engine/6000.7/script-reference/unity/collections/copyerror.md) | CopyError.None if successful. Returns CopyError.Truncation if the source string is too large to fit in the destination. |

### Remarks

When the method returns an error, the destination string is not modified.
