Прочетете на английски Редактиране

Споделяне чрез


TextFieldParser.TrimWhiteSpace Property

Definition

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

C#
public bool TrimWhiteSpace { get; set; }

Property Value

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

Examples

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

VB
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

Remarks

The default value for this property is True.

Applies to

Продукт Версии
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also