0

I'm importing files from a unicode .txt. I have several hundred lines, and used an Excel macro to split them (I would like to use a database, but we cannot due to certain regulations). An example file would be:

Office Name: "Blue";    LastYTD:    38.55%  ;   ThisYTD:    4.50%   ;

How can I make a line break after each ;? I would like to add it directly into the Excel file before it is split if possible. Thanks!

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • Could please provide some more context? Are you having this data as a *string* in JavaScript? How are Excel and JavaScript related? – Felix Kling Jun 21 '13 at 20:57

1 Answers1

2

You can make an array of lines with .split() and join it back into a string:

text.split(';').join('\n');

Or just replace them:

text.replace(/;/g, '\n');

\n is the escape sequence for a newline.

Blender
  • 289,723
  • 53
  • 439
  • 496