Reputation: 15
I don't have access to VB.NET right now so I can't test this value:
Dim lst As New List(Of String)(cookieValue.Split("$"c))
i got this from another question , but was wondering if A. The list will populate correctly and B. What does the c represent?
Upvotes: 0
Views: 358
Reputation: 11773
'test string
Dim ipsum As String = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
'split based on a string
Dim lst_str As New List(Of String)(Strings.Split(ipsum, "in"))
'split based on a char
Dim lst_chr As New List(Of String)(ipsum.Split(New Char() {"$"c}, StringSplitOptions.RemoveEmptyEntries))
Upvotes: 0
Reputation: 887365
Yes, it will.
It passes a string array to the List(IEnumberable<T>)
constructor.
"$"c
is a character literal.
Upvotes: 1