This is split the your string value using the special character
private void SplitString() { string _BaseString="RIVE-SENT-KUMA-XXX" string[] seperate_filelds = _BaseString.Split('-'); int counter = 0; // bool is_legit = false; foreach (string each_field in seperate_filelds) { counter++; // reading the first field which is prefix field if (counter == 1) { //fristValue = "RIVE"; string fristValue = each_field ; } else if (counter == 2) { //secondValue = "SENT"; string secondValue = each_field ; } else if (counter == 3) { //thirdValue = "SENT"; string secondValue = each_field ; } else if (counter == 4) { //furthValue = "XXXX"; string furthValue = each_field ; } else { break; } } }
0 comments
Post a Comment