Split on Line Break

Hi Codan wizards,

Value.Split(LineBreak()) isn’t working, and neither is Value.Split(Character(10)) or Value.Split(Character(13)). I’ve created an example doc (below). The “Num Lines” values should all be 5, as the CSV file in the “Value” column is made up of 5 rows. Coda support suggested I post this in the forums. Does anyone have suggestions on how I can split a text value based on line breaks?

1 Like

Hi @Matthew_Strax-Haber,

note sure your initial data do have linebreaks.

If I erase the first “linebreak”, and replace it with alt+enter, it’s OK and the split works. I assume the break you have is not exactly the same as “official” one, but I lack capacities to know the difference and how to track it without changing all your input data

image

The input definitely has line breaks – there are 5 rows of comma separated values. Coda has two different ways of creating a line break – Shift+Enter or Enter. However, both create a character that should be able to be used as a character for splitting. If not via LineBreak(), then at least via Character(n). It’s an odd bug. I also think it was working properly until a few weeks ago, but I’m not sure.

1 Like

Yes, difficult to understand in my side also. I sometimes use character(10) to create linebreak, but it’s not working in your table. Waiting for a best coda wizard here… :wink:

Alas, I found a hacky workaround which does the job.

thisRow.[Value].RegexReplace('(.*)',"$1").Split(LineBreak())

In theory, the RegexReplace should make no difference on line breaks, but it does. I don’t think there’s a good reason for this, but it works. I’m posting it here in case it helps someone else.

Best,
Matt

1 Like