vb.net - How to split a string by using more than one delimiter -
vb.net - How to split a string by using more than one delimiter -
below script used in ssis package.
if (row.answertype.trim().toupper = "multiple select" , _ row.surveyquestionid = row.surveydefinitiondetailquestionnumber) dim question1 string = row.surveydefinitiondetailanswerchoices.toupper.trim() dim ans1 string = row.surveyanswer.toupper.trim() each x string in ans1.split(new [char]() {cchar(vbtab)}) if question1.contains(x) row.isskipped = false else row.isskipped = true 'row.isallowed = true row.errordesc = "invalid value in reply column multiple select!" end if next end if
this script succeeds when having tab delimiter. need both tab , non tab characters delimiters.
add needed characters character array
ans1.split(new [char]() { cchar(vbtab), cchar(" "), cchar(";") })
or
ans1.split(new [char]() { cchar(vbtab), " "c, ";"c })
by using character literal suffix c
.
vb.net
Comments
Post a Comment