I have a quick question, please help me if you have an idea: 1- i need to read the data in another format, in the desired answer the records must be separated by &&, and without braces { } . in my file each record is written in one line . I have this now:

R2 = ReadList["C:\\Users\\hessam\\Documents\\Mathout.txt", String]
result ----> {xP == x + y, yP == x + y + z, zP == z, wP == w} // i dont want this
// must be this xP == x + y && yP == x + y + z && zP == z && wP == w

String replace does not help because each returned record is a separate string. i dont know how to handle it.

StringReplace[R2, "," -> "&&"]



1 Answer 1


Assume R2 contains a list of strings as returned from ReadList.

We may then use the 2 argument form of StringRiffle to obtain what you want:

res=StringRiffle[R2, "&&"]

enter image description here

Head reveals that this is really only one string:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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