c# slice a string index of specific character

时间:2019-03-19 14:38:27

标签: c# string

I want to slice that string conStr = "server='MyServer';DataBase='MySQL';username='myAdmin';password='myPass';"

indexOf(;)

and parse the values into an object{string server, string DataBase,etc} how should i do that?

1 个答案:

答案 0 :(得分:2)

You can use Split function to split your string into tokens

string phrase = "server='MyServer';DataBase='MySQL';username='myAdmin';password='myPass';";
string[] words = phrase.Split(';');
相关问题