eb25f070 2d48 63e6 b009 b82e5069122f - akesseler/Plexdata.CsvParser GitHub Wiki

ProcessHelper.SplitIntoCells Method

This method splits given line into its parts using given separator.

Namespace: Plexdata.CsvParser.Internals
Assembly: Plexdata.CsvParser.NET (in Plexdata.CsvParser.NET.dll) Version: 1.1.3+d5bef99aa35461ce4bafadf0bf2c2aeca18044ea

Syntax

C#

public static List<string> SplitIntoCells(
	string line,
	char separator
)

Parameters

 

line
Type: System.String
The line to be split.
separator
Type: System.Char
The separator at which to split.

Return Value

Type: List(String)
A list of strings representing all parts of given line.

Remarks

Well, standard string split would actually not work for this purpose. For example, one of the exceptions is that strings are split at the separator, no matter if the separator is inside or outside a string that is surrounded by double-quotes. This means that something like "Head,er1",Header2,Header3 would be split into ["Head] [er1"] [Header2] [Header3].

This method puts respect on that by skipping everything which is enclosed double-quotes. Taking the example from above would result in [Head,er1] [Header2] [Header3] which seems to be the wanted result. Further, leaving out some of the double-quotes would also work in certain scale. But be always aware, a constellation like "Head,er1","Header2,Header3" would end up in [Head,er1] [Header2,Header3]!

See Also

Reference

ProcessHelper Class
Plexdata.CsvParser.Internals Namespace

⚠️ **GitHub.com Fallback** ⚠️