Parse content of a string to a 2D-string array.

Namespace: ExpSuite
Assembly: FrameWork (in FrameWork.exe) Version: 1.0.0.0

Syntax

Visual Basic
Public Function ParseString ( _
	szSource As String, _
	ByRef szArr As String(,), _
	pbStatus As ProgressBar _
) As String

Parameters

szSource
Type: System..::..String
Row in CSV format.
szArr
Type: array<System..::..String,2>[,](,)[,][,]%
Array with values retrieved from szSource.
pbStatus
Type: System.Windows.Forms..::..ProgressBar
Progressbar to show the progress of parsing. Optional.

Return Value

Error message, empty if no error ocured.

Remarks

A string of a CSV file will be parsed and all found values well be copied to szArr().
Rules (if " is Quota and , is Separator):
  • " : mszQuota
  • , : Separator
  • row : cell,cell,cell
  • not quoted cells:
  • ab,cd -> two cells: ab and cd
  • ab"cd -> ab"cd
  • ab""cd -> ab""cd
  • ab" -> ab"
  • ab"" -> ab""
  • quoted cells:
  • "ab" -> ab
  • "ab,cd" -> ab,cd
  • "ab"cd -> ab and ignore cd
  • "ab"de" -> ab and ignore cd
  • ""abcd -> empty cell and ignore abcd
  • "ab""cd" -> ab"cd
  • "ab"",cd" -> ab"cd
  • """abcd" -> "abcd
  • last quoted cell in a row:
  • "abEOL -> ab
  • "ab"EOL -> ab
  • "ab""EOL -> ab"
  • "ab"""EOL -> ab"
  • "ab""cdEOL -> ab"cd
  • Empty row -> one empty cell
  • See Also