开发者

Split and store strings in array

I'm retrieving data from Active Directory(name,department,title,company,mail) into a string seperated by commas and I want to split the string and store them to array where i can export it in excel before updating it to my database.

but i how do i store them to an array?

here's the code:

I'm getting data from AD and storing it in list:

Dim formattedName As String = String.Format("{0},{1},{2},{3},{4},{5}", _
                                     resEnt.Properties("name")(0).ToString(), _
                                     resEnt.Properties("company")(0).ToString(), _
                                     resEnt.Properties("department")(0).ToString(), _
                                     resEnt.Properties("title")(0).ToString(), _
                                     resEnt.Properties("sAMAccountName")(0).ToString(), _
                                     resEnt.Properties("Mail")(0).ToString())

                userList.Add(formattedName)

after the above loop is done, i'm printing it out. but now i want to split it and store all the data into array

For i = 0 To userList.Count - 1
            Response.Write("<BR>" & userList(i).ToStri开发者_运维百科ng())
        Next

how do i split and store them?


try

Dim strArr() As String
strArr = userList(i).ToString().Split(",")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜