13
Answers

String.Split() Problem

Sasi Reddy

Sasi Reddy

11y
2.1k
1
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)