hi i have this large string! my microcontroller send this to my pc and i read this with
RxString = serialPort1.ReadExisting();
the microcontroller send this
POOL1#0:00:18,POOL2#0:00:25,POOL3#0:00:32,POOL4#0:00:39
i wand to display the
POOL1 time 0:00:18 to textbox3
POOL2 time 0:00:25 to textbox4
POOL3 time 0:00:32 to textbox5
POOL4 time 0:00:39 to textbox6
is any way to to this???

Sadaqat Hussain59 reputationPosted Sep 18, 2008, 10:43 PM EDT
In c# here is string.
string have method split in which you will provide the split character and this you return array of string.
string str;
str=Pool1#1234#abc#XYZ;
string arraystring[];
arraystring[]= str.split('#' ,str)
Ryan AlfordRank #1,411 · 1.2K reputationPosted Sep 19, 2008, 6:48 AM EDT
string RxString = serialPort1.ReadExisting();
string[] firstSplitString = RxString.Split(new char[] {',' });
string[] secondSplitString;
for (int i = 0; i < firstSplitString.Length; i++)
{
if (i == 0)
{
secondSplitString = firstSplitString[i].Split(new char[] {'#' });
textBox3.Text = string.Format("{0} time {1}", secondSplitString[0], secondSplitString[1]);
}
else if (i == 1)
{
secondSplitString = firstSplitString[i].Split(new char[] { '#' });
textBox4.Text = string.Format("{0} time {1}", secondSplitString[0], secondSplitString[1]);
}
else if (i == 2)
{
secondSplitString = firstSplitString[i].Split(new char[] { '#' });
textBox5.Text = string.Format("{0} time {1}", secondSplitString[0], secondSplitString[1]);
}
else if (i == 3)
{
secondSplitString = firstSplitString[i].Split(new char[] { '#' });
textBox6.Text = string.Format("{0} time {1}", secondSplitString[0], secondSplitString[1]);
}
}
first, you split on the comma to get the different "POOLS". next you split each "POOL" on the # sign to get the text.