4

Below a script I used in my SSIS package.

If (Row.AnswerType.Trim().ToUpper = "MULTIPLE SELECT" And _
    Row.SurveyQuestionID = Row.SurveyDefinitionDetailQuestionNumber) Then

    Dim Question1 As String = Row.SurveyDefinitionDetailAnswerChoices.ToUpper.Trim()
    Dim ans1 As String = Row.SurveyAnswer.ToUpper.Trim()

    For Each x As String In ans1.Split(New [Char]() {CChar(vbTab)})
        If Question1.Contains(x) Then
            Row.IsSkipped = False
        Else
            Row.IsSkipped = True
            'Row.IsAllowed = True
            Row.ErrorDesc = "Invalid Value in Answer Column For Multiple Select!"
        End If
    Next
End If

This script only succeeds when having a tab as delimiter. But I need both tab and non tab characters as delimiters.

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188
Dinesh
  • 303
  • 2
  • 6
  • 19

1 Answers1

11

Add all the needed characters to the character array

ans1.Split(New [Char]() { CChar(vbTab), CChar(" "), CChar(";") })

Or

ans1.Split(New [Char]() { CChar(vbTab), " "C, ";"C })

by using the character literal suffix C.

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188