I had a question regarding the split function used in Visual Basic. As of now I have written a function that brings in a string value. The string value returned will probably look like this "List1;List2; Field1,Field2". My goal is to use the split function for this string to put all the lists in one array and to put the fields in another array.
The problem is between where List2 and Field1 are. I don't want Field1 to be placed in the list array. I'm thinking there might be a way to do this by parsing but I'm not sure. Here is my current code below. Thanks in advance for any help.
Dim s As String = GetSetting("ReOrderList", properties.SiteId) Dim affectedLists() As String = s.Split(";") Dim affectedFields() As String = s.Split(",")
If you know that the lists will come before the fields, you can chop the string at the last ';' character:
Dim splitPos As Integer = input.LastIndexOf(";"c) Dim lists As String = input.Substring(0, splitPos+1) Dim fields As String = input.Substring(splitPos+1, input.Length - (splitPos+1))
Then you can work on the lists and fields separately.