Sasi Reddy

Sasi Reddy

  • NA
  • 346
  • 219.4k

String.Split() Problem

Feb 21 2014 2:14 AM
string  current1="02/02/1988";
string[] ar1=current1.Split('/');
string ar2=ar1[2];
I am getting error like this.Index was outside bounds of the array @last line
If i put same code in IIS
string current1="02/02/1988";
string[] ar1=current1.Split('/');
string ar2=ar1[2];

I am not getting any error
Could you please solve above problem?.
If i put this code as normal like this
string current1="02/02/1988";
string[] ar1=current1.Split('-');
string ar2=ar1[2];
 
sometimes i am getting error and sometimes not getting error 

  



Answers (13)