vendredi 8 mai 2015

Splitting string into multiple strings using LINQ

I am trying to split this string

string s = sn DC0000002; mac 00:0c; uuid 564d6ae4-979

I need to get these values from above string DC0000002 , 00:0c , 564d6ae4-979

For this I have tried below query but not able to able to get last two values I mean these two values (00:0c , 564d6ae4-979)

Below is the query for splitting

List<string> decryptedList = new List<string>();
decryptedList = decodePP.Split(';').Select(x => x.Split(' ')[1]).ToList();

orgSNo = decryptedList[0]; //Output - DC0000002
orgMacID = decryptedList[1];// output - mac // this is wrong need to get value
orgUUID = decryptedList[2]; //output - uuid // this is also wrong 

Would anyone please help on this query how extract values from the above string using LINQ query in a single shot?

Aucun commentaire:

Enregistrer un commentaire