Editor for WinForms | ComponentOne
C1.Win.C1Editor.4.5.2 Assembly / C1.Win.C1Editor Namespace / C1TextRange Class / Trim Method
Example

In This Topic
    Trim Method
    In This Topic
    Moves start and end pointers of the range to exclude leading and trailing white-space characters from the current range.
    Syntax
    'Declaration
     
    Public Sub Trim() 
    public void Trim()
    Example
    The code below sets new background color for all words in selection, excluding leading and trailing white spaces.
    private void button1_Click(object sender, EventArgs e)
    {
       C1TextRange r = c1Editor1.Selection.Clone();
       r.Trim();
       r.ApplyStyle("background-color", "#999999", C1StyleType.Character);
    }
    See Also