maje90
(Riccardo Majewski)
January 30, 2023, 11:26am
21
What about this:
replace your splitting character with another uncommon symbol + your character
split your text by using the uncommon symbol
For example:
“The quick@ brown fox jum@ps over the lazy dog”
Replace “@” with “%@”
now you have
“The quick%@ brown fox jum%@ps over the lazy dog”
now split by using “%”
The quick
@ brown fox jum
@ps over the lazy dog
text split keeping splitters.gh (12.1 KB)
(The null checking and stream filter is for when you have a single text string input at start…)
5 Likes
kev.r
(Kevin)
January 30, 2023, 11:31am
22
Yes, that is a much simpler solution.
-Kevin
GH-KN
(GH-KN)
February 11, 2023, 9:52pm
23
Hi Kevin,
I got one more challenge to go.
Would it be possible to modify the script in such a way, that the ‘original Path’ is also present in the end result?
e.g. example below:
2023-02-11 Split text and keep splitting character + tree structure.gh (12.6 KB)
Many thanks
kev.r
(Kevin)
February 11, 2023, 11:08pm
24
I prefer using C# over Python for manipulating DataTrees.
Here’s how I would do this (slight modification to the C# component I posted before):
Edit: add grasshopper file
2023-02-11+Split_txt_keep_splitters+tree_paths_re.gh (12.6 KB)
-Kevin
1 Like