开发者

VB.NET: Will the following list populate correctly?

I don't have access to VB.NET right now so I can't test th开发者_如何学运维is 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?


Yes, it will.
It passes a string array to the List(IEnumberable<T>) constructor.

"$"c is a character literal.


    '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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜