Splitting a Piped String Help

Hello all.  I have a dropdown that my 0 index has a piped account number like 112121|321333|343242.  I need to somehow loop through and grab each number and then use it in a call.  Can anyone give me help with this.  Its in a SelectedValue
sbornstein2Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ravi SinghConnect With a Mentor Senior Software EngineerCommented:
Hi, use the split method and specify a delimiter, it'll return a string array with each number on a seperate index:

string accountNumbers = this.comboBox1.SelectedValue.ToString(); //get the value
string[] accountNumberArray = accountNumbers.Split('|'); //split it

foreach (string actNum in accountNumberArray) //loop through array
{
     //use actNum here
}
0
 
sbornstein2Author Commented:
thank you so much
0
All Courses

From novice to tech pro — start learning today.