Suppose I have a very long string
x=2*g*o*p*s*v-2*B*g*o*p*s*v*w+2*a*c*g*m*o*p*s*v+2*c*g*m*o*p*s*v*B-2*a*c*g*m*o*p*s*v*B+3*g*m*o*p*s*v*B-3*B*g*m*o*p*s*v*w*B+m*w**2*B +5*a*c*g*m**2 +o*p*s*v*B -a*c*m**2*w**2*B +c*g*m**2*o*p*s*v*B* - 3*a*c*g*m*o*p*s*v*+c*m**2-w**2*B-a*c*m**2-w**2*B....)
etc that goes on for almost 1000 lines. When exported to a .txt file, the file is >100MB. I want to use the expression in Fortan and Fortan will not accept lines greater than 100 characters or so.
To the string x
, is it possible to insert a linebreak every 100 characters and insert &&
at the end of each line and at the beginning of the next line?
StringInsert[str, "&&\n&&", #] &@Range[100, StringLength@str, 100]
$\endgroup$