Converting a multiline data into lines (11.0 KB)

Hi im a bit stuck with converting text into a usable set of data.
Problem is the input generates a multiline data.
but i want to covert it in a list for each row.

Added picture shows the preferred output.

at the bottum ive added some blocks which i think would help me get there after i get the first step done

By default, Split separates with the whitespace character (e.g. " "). You want to use a newline character (e.g. “\n”) instead.

1 Like

any 1 has a tip for converting the first text pannel into the secund pannel?

Here you go!

could you upload the .gh file?

Sure. Sorry. (12.3 KB)

ah i see, thats why i wasnt getting the same output you ware showing.
i thought you placed the split on the first pannel.

this is an output i get from a program, which ware im currently stuck at.
from getting that data to be converted into lines like the pannel next to it.

Use the Text Split component. Connect a Panel containing one newline character to the Separators (C) input.

  • Drop a Panel on the canvas.
  • Double-click to edit.
  • Press enter one time.
  • Click the ok button.

You get an extra item at the end of the output list because your input text contains an extra newline character at the end. You can correct this by using the Text Trim component:


1 Like

ok thanks, not sure why my output is different then yours but i can cull the empty fields and get the same result.

Not sure why you’re getting the empty lines. I was using the file you posted at the top of the thread.

I just re-downloaded your file it and I still don’t get those empty lines: (11.1 KB)


wierd enoff when i open your gh, i also get the empty output.

mybe it has to do with an older version of rhino7? → older gh version?

That is strange. I am running the latest service release candidate.

Rhino 7 SR20 2022-6-27 (Rhino 7, 7.20.22178.01002).

I am on MacOS. Perhaps it’s a Mac / Windows difference?


im not running the latest version of rhino so it might be on my end

thanks for the help

Try “\r” instead of “\n”. Maybe that will do the trick.
I’m on macOS, too.

The problem is the way the Panel component handles text.

Here’s the results I get when I enter a single newline in a Panel using this method:

  • Drop a Panel on the canvas.
  • Double-click to edit.
  • Press enter one time.
  • Click the ok button.

On MacOs, I get this. Everything looks ok, the text is split correctly:

On Windows, I get this. The split text has extra empty lines and you can see from the python script that the panel is outputting “\r\n”

When I enter “\n” in a Panel I get this result on both Windows and MacOS. The Panel is outputting the literal characters (not escaping them). You can see that the text splits at the n character:

This works on both MacOS and Windows.

A python script with a single line of code.

a = "\n"

I did some searching and didn’t come up with any recommended methods to escape special characters in grasshopper.


1 Like

Here’s an example where it’s all done with Python: (10.7 KB)

1 Like