# Why do I get two different results from StringLength?

I spent a reasonable amount of time to find the origin of an error in a larger code segment.

str = StringToStream["a1;b1;c1"];

data1 = ReadList[str, Record, 1];
StringLength[data1]
{8}

SetStreamPosition[str, 0];

data2 = Read[str, Record];
StringLength[data2]
8

Close[str];


You can't calculate with a {8}.

-

data1 is {"a1;b1;c1"} and data2 is "a1;b1;c1".

And StringLength[{"abc", "defg", "hijkl"}] is {3,4,5}

It's all because ReadList unsurprisingly returns a list

-

Because

data1 == {"a1;b1;c1"}


and

data2 == "a1;b1;c1"


### Edit

Note that StringLength has the attribute Listable, so it will map across the items in a list.

-