Split Strings @ set character lengths with variable string lengths

Hi all,
Little lost , could anyone help me with the best approach to achieve this.
Cheers
K
SplittingTextNotes@NthCharacter.dyn (59.1 KB)

This should work most of the time. String lengths could sometimes be a little shorter than the specified minimum as it splits at spaces


splitString.dyn (30.9 KB)

2 Likes

@Vikram_Subbaiah thanks that looks to work very well. Still have to get my head around it though.
Tweaked a couple levels to get it to work on single & multiple list lengths.

splitString[b].dyn (95.9 KB)
cheers K

@Kai Python to the rescue!
SplittingTextNotes@NthCharacter.dyn (17.2 KB)

import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")
import textwrap
if hasattr(IN[0],"__iter__"):
	OUT = [textwrap.fill(x,IN[1]) for x in IN[0]]
else:
	OUT = textwrap.fill(IN[0],IN[1])

import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")
import textwrap
if hasattr(IN[0],"__iter__"):
	OUT = [textwrap.wrap(x,IN[1]) for x in IN[0]]
else:
	OUT = textwrap.wrap(IN[0],IN[1])
3 Likes

thanks @AmolShah :exploding_head:
very nice.