I have a string that is being passed from a web form as:
ABC_12345;DEF_78901
how can I get the prefixes of each value and then combine those and pass such as to SQL 'ABC','DEF'
I have a string that is being passed from a web form as:
ABC_12345;DEF_78901
how can I get the prefixes of each value and then combine those and pass such as to SQL 'ABC','DEF'
First Split the string into Array
Dim DBSplit1() As String
DBSplit1 = YourString.Split(";")
'Then get the the Prefix of you string
Dim Result As New List(Of String)
For Each item As String In DBSplit1
Dim rs As String = item.Substring(0, 3)
Result.Add(rs)
Next
'Then join the list of string with comma
Dim StringResult As String = String.Join(", ", Result.ToArray())