Class StringTruncater
Class which truncates strings.
Inheritance
System.Object
StringTruncater
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: JK.Common.Text
Assembly: JK.Common.dll
Syntax
public class StringTruncater
Constructors
| Improve this Doc View SourceStringTruncater(String)
Initializes a new instance of the StringTruncater class.
Declaration
public StringTruncater(string originalText)
Parameters
Type | Name | Description |
---|---|---|
System.String | originalText | Text to be truncated. |
StringTruncater(String, String)
Initializes a new instance of the StringTruncater class.
Declaration
public StringTruncater(string originalText, string indicator)
Parameters
Type | Name | Description |
---|---|---|
System.String | originalText | Text to be truncated. |
System.String | indicator | Indicator to be placed within the truncated text to indicate that a truncation has taken place. |
Properties
| Improve this Doc View SourceIndicator
Gets or sets the indicator to concatenate to the end of truncated text. Ex: '...'
Declaration
public string Indicator { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceTruncateToLength(in Int32)
Truncates the original text to a given length.
Declaration
public string TruncateToLength(in int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | length | Length of string to output. |
Returns
Type | Description |
---|---|
System.String | Original text truncated to given length. |