Edit

Share via


StringExtensions.Truncate Method

Definition

Overloads

Truncate(String, Int32)

Truncates a string to the specified length.

Truncate(String, Int32, Boolean)

Truncates a string to the specified length.

Truncate(String, Int32)

Truncates a string to the specified length.

public static string Truncate (this string? value, int length);
static member Truncate : string * int -> string
<Extension()>
Public Function Truncate (value As String, length As Integer) As String

Parameters

value
String

The string to be truncated.

length
Int32

The maximum length.

Returns

Truncated string.

Applies to

Truncate(String, Int32, Boolean)

Truncates a string to the specified length.

public static string Truncate (this string? value, int length, bool ellipsis);
static member Truncate : string * int * bool -> string
<Extension()>
Public Function Truncate (value As String, length As Integer, ellipsis As Boolean) As String

Parameters

value
String

The string to be truncated.

length
Int32

The maximum length.

ellipsis
Boolean

true to add ellipsis to the truncated text; otherwise, false.

Returns

Truncated string.

Applies to