use String.join to get string of array and then use replace to remove ^ from string
example
string[] array = new string[] { "12", "34", "5^67", "8^945", "^63^", "9484^" };
string myStr = String.Join("", array);
string temp = myStr.Replace("^", "");
textBox1.Text = temp;
or try this
string[] array = new string[] { "12", "34", "5^67", "8^945", "^63^", "9484^" };
string finalOpStr = "";
foreach (string message in array)
{
finalOpStr = finalOpStr + message.Replace("^", "");
}
finalOpStr = string.Format("9999,999,999,99,9999", finalOpStr).ToString();
textBox1.Text = finalOpStr;
if u mean o/p 12345,678,945,63,9484 is list items separated by comma...u want get this messages by separating ^ and store in list array and as u want use for loop for it ...then in ur main code there is need to do some changes exa.
string[] array = new string[] { "12", "34", "5^67", "8^945", "^63^", "9484^" };
List<string> myString=new List<string>();
foreach (string message in array)
{
if (message.Contains("^"))
{
string message1 = message;
while (message1.Contains("^") || message1!="")
{
int pos = -1;
pos = message1.IndexOf('^');
if (pos != -1)
{
outputString = message1.Substring(0, pos);
message1 = message1.Substring(pos + 1);
if (tempString != "" || outputString != "")
{
outputString = tempString + outputString;
myString.Add(outputString);
tempString = "";
}
}
else
{
tempString = message1;
message1 = "";
}
}
}
else
{
outputString = outputString + message;
tempString = tempString + message;
}
}
textBox1.Text = string.Join(",",myString.ToArray());
i think it will help u.