SOLVED:string length after strtok

void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);

char original[50]="+CIPSNTPTIME:Fri Jun 01 22:55:56 2018";
char temp[50]={0};
byte b=0;

strcpy(temp,original);
Serial.print("temp length=");
Serial.println(strlen(temp));

strtok(temp,":");
Serial.print("temp length after strtok=");
Serial.println(strlen(temp));

for(byte i=0,b=strlen(temp);b<strlen(original);i++,b++){
  
  temp[i]=original[b];
  Serial.print("i=");
  Serial.print(i);
  Serial.print('\t');
  Serial.print("b=");
  Serial.print(b);
  Serial.print('\t');
  
  Serial.write(temp[i]);
  Serial.println();
}
Serial.println();
Serial.print("temp length=");
Serial.println(strlen(temp));
Serial.print("original length=");
Serial.print(strlen(original));

}
void loop() {
  // put your main code here, to run repeatedly:

}

output

temp length=37
temp length after strtok=12
i=0	b=12	:
i=1	b=13	F
i=2	b=14	r
i=3	b=15	i
i=4	b=16	 
i=5	b=17	J
i=6	b=18	u
i=7	b=19	n
i=8	b=20	 
i=9	b=21	0
i=10	b=22	1
i=11	b=23	 
i=12	b=24	2
i=13	b=25	2
i=14	b=26	:
i=15	b=27	5
i=16	b=28	5
i=17	b=29	:
i=18	b=30	5
i=19	b=31	6
i=20	b=32	 
i=21	b=33	2
i=22	b=34	0
i=23	b=35	1
i=24	b=36	8

temp length=37
original length=37

how come temp length is 37 instead of 25?

strtok() destroys the original string. If you need it afterwards, you'll need to make a copy before strtok() gets to it.

how come temp length is 37 instead of 25?

I wonder: could it be because there are 37 characters in temp?

ok and where I destroyed it ?

before destroying I copied whole string with strcpy to temp.

before destroying I copied whole string with strcpy to temp.

All 37 of them!

yes all 37 of them then

strtok(temp,":");
Serial.print("temp length after strtok=");
Serial.println(strlen(temp));

shows that strlen is 12 not 37.

SOLVED:
temp[i+1]=’\0’;
or b<=strlen(original) didnt notice < before

Go back and reread the strtok() description and find a few examples and run those. temp is all chopped up after strtok() so it's length is meaningless. If you don't preserve the "intermediate" strings that strtok() creates, those, too, are lost.

strtok() replaces the separator with a null, but then you copy it back:

for(byte i=0,b=strlen(temp);b<strlen(original);i++,b++){
    temp[i]=original[b];

original[strlen(temp)] is the separator, right?

original: abc:def
temp:     abc:def
strtok:   abc0def
strlen(temp): 3
temp[3] = original[3]: abc:def