TextFieldParser.TrimWhiteSpace Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Indicates whether leading and trailing white space should be trimmed from field values.

Namespace:   Microsoft.VisualBasic.FileIO
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public bool TrimWhiteSpace { get; set; }

Property Value

Type: System.Boolean

True if leading and trailing white space should be trimmed from field values; otherwise, False.

The default value for this property is True.

This example creates a TextFieldParser, FileReader, and sets the TrimWhiteSpace property to True.

Using FileReader As New Microsoft.VisualBasic.FileIO.
    TextFieldParser("C:\ParserText.txt")

    FileReader.TextFieldType = 
        Microsoft.VisualBasic.FileIO.FieldType.Delimited
    FileReader.SetDelimiters(",")
    FileReader.TrimWhiteSpace = True
End Using

.NET Framework
Available since 2.0
Return to top
Show: