1
Reply

Trouble with lilstbox and arrays

MIke Lumley

MIke Lumley

Apr 21 2012 8:09 AM
1.1k

Hi All
 I have a listbox with a list like below

1.     05/7/11</TD><TD><spanclass=/>John</span></TD><TD><spanclass=/>
2.     05/07/11</TD><TD><spanclass=/>Tena</span></TD><TD><spanclass=/>
3.     09/8/11</TD><TD><spanclass=/>Larry</span></TD><TD><spanclass=/>
4.     05/11/11</TD><TD><spanclass=/>Glenda</span></TD><TD><spanclass=/>

Using the code below that shuld check for a single digit month

string regExp1 = "(?<Month>\\d{1,2})/(?<Day>\\d{1})/(?<Year>(?:\\d{4}|\\d{2})).*";
string arr;
for (int a = 0; a < 99; i++)
{
   arr = arrStrUSA[a];
   if (arr == regExp1)
   {
       arr.Insert(4, "0");
       listBox2.Items.Add(arr);
   }
   else
   {
   listBox2.Items.Add(arr);
   }
}

I thought I could iterate through the listbox adding a 0 to the front of the ones with a single digit for a month but nothing comes.
What I need to do is add 0 to line 1, 3 so they look like lines 2, 4
then delete "</span></TD><TD><spanclass=/>"

Thanks in advance

Mike


Answers (1)