jeudi 2 avril 2015

string length not computing correctly

Am I seeing things or is it just late. I'm trying to get the string length and I keep getting an incorrect value.


h.Length keeps coming up as 3! as if it's checking the size of the hour array.


When I look at the local variable 'h' it does show "6", so h.Length should be calculated as 1, not 3, right?



startTime = "6:00:00 AM";

string[] hour = startTime.Split(':');
string h = hour[0];
if (h.Length == 1)
{
startTime = "0" + startTime;
}

Aucun commentaire:

Enregistrer un commentaire