StringExtensions.Truncate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.