Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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];

SetStreamPosition[str, 0];

data2 = Read[str, Record];


You can't calculate with a {8}.

share|improve this question

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

share|improve this answer


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


data2 == "a1;b1;c1"


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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.