Method Truncate
Truncate(String, Int32)
If value is longer than maxLength it is truncated at that character position, otherwise the original string is returned.
Declaration
public static string Truncate(this string value, int maxLength)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to truncate. |
| System.Int32 | maxLength | The the point at which to truncate the string, if it exceeds that length. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that is no longer than |
Remarks
If value is null, null is returned. If maxLength is zero, System.String.Empty is returned.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown if |