How to get rid of mysterious empty lines in a list

I have a list of 6908 data elements. However, when I hover the mouse over the data component, there are empty lines in the preview of the data that are not shown using a panel.

If I copy the data out and paste it to sublime, there are 7018 lines of data, and all the extra lines are empty.

My questions are:

  1. why the empty lines are shown in the preview of the data component, but not in the panel?
  2. How to remove these mysterious invisible empty lines, or invisible line breaks?

Thank you.



2022-08-23-14-44-24
2022-08-23-14-45-04

mysterious emptly lines.gh (43.7 KB)

You likely have some “\n” or “\r\n” inside your text. You can use any text editor with a replacement functionality and simple replace these with nothing.

That’s what I understand, too. But is there a way to do this kind of “line break removal” in Grasshopper using native components?

Does the CleanTree component get rid of them?

‘Text Replace’ should also work. These characters are not visualized, but obviously they are there. But I would always prefer to clean up the data before loading in. Anyhow, this should solve it.

You have some invisible line-break characters in your data.

Simply use the Text Trim component to get rid of them:

2 Likes