TextFieldParser.TrimWhiteSpace Property

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

' Usage
Dim value As Boolean = TextFieldParserObject.TrimWhiteSpace
' Declaration
Public Property TrimWhiteSpace As Boolean

Property Value

Boolean.

Remarks

The default value for this property is True.

Example

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

Requirements

Namespace:Microsoft.VisualBasic.FileIO

Class:TextFieldParser

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Permissions

No permissions are required.

See Also

Tasks

How to: Read From Comma-Delimited Text Files in Visual Basic

How to: Read From Fixed-width Text Files in Visual Basic

How to: Read From Text Files with Multiple Formats in Visual Basic

Concepts

Parsing Text Files with the TextFieldParser Object

Reference

TextFieldParser Object

TextFieldParser.TrimWhiteSpace

My.Computer.FileSystem.OpenTextFieldParser Method