If I use a 2-line item description, but want to actually make it into 4 lines by manually adding \r\n (or something like that) into the description, what would be the command to split it into a 4-element array?
For example:
Item description is:
This is the first line\r\nof a long description
This is the second line\r\nof a long description
The two lines are separated by \r\n even though you can't see it.
if I say: p description.split(/[\r\n]+/)
I get this:
["This is the first line\\r\\nof a long description","This is the second line\r\nof a long description"]
What I want is this:
["This is the first line","of a long description","This is the second line","of a long description"]
I've tried using gsub to change "\r\n" to /\r\n/ but in addition to not working, it also messed up the actual line break that was already there.
btw - I know this will not be shown as a 4-line description by any of the RTP scripts. I am using it for a different purpose.
For example:
Item description is:
This is the first line\r\nof a long description
This is the second line\r\nof a long description
The two lines are separated by \r\n even though you can't see it.
if I say: p description.split(/[\r\n]+/)
I get this:
["This is the first line\\r\\nof a long description","This is the second line\r\nof a long description"]
What I want is this:
["This is the first line","of a long description","This is the second line","of a long description"]
I've tried using gsub to change "\r\n" to /\r\n/ but in addition to not working, it also messed up the actual line break that was already there.
btw - I know this will not be shown as a 4-line description by any of the RTP scripts. I am using it for a different purpose.