I have a text box and there are some string in it that could be anything and I need to split that string into every 38 characters But the code I use does not work properly Because sometimes after 38 characters it is possible to create the correct separation on a word like:
for example, my string is:
"Well, my house is very cluttered...very cluttered. Just things that were left behind from other generations and some of my mom's things and my granddad's things. Also things that I've accumulated over the years. I definitely have concerns about when Joaquin starts walking that, you know, he could hurt himself, like, get into something or, like, pull something down."
and after separation:
Well, my house is very cluttered...ver
y cluttered. Just things that were lef
t behind from other generations and so
me of my mom's things and my granddad'
s things. Also things that I've accumu
lated over the years. I definitely hav
e concerns about when Joaquin starts w
alking that, you know, he could hurt h
imself, like, get into something or, l
And as you can see, very, left, Walking, have been separated And the sentence sequence has not been added (like, pull something down.").
Is there a code that does this separation intelligently, that is, it separates 36 characters, and if these 36 characters were in the middle of a word, it separates even less, That is not a problem like
Quote:
Well, my house is very
cluttered...very cluttered. Just
things that were left behind from
other generations and some of my
mom's things and my granddad's
things. Also things that I've
accumulated over the years. I
definitely have concerns about
when Joaquin starts walking that,
you know, he could hurt himself,
like, get into something or,
like, pull something down.
The code I use is very simple and basic.
Please show me the code if there is a solution to this problem. Thank you very much
What I have tried:
Dim s = TextBox1.Text
Dim list = Enumerable.Range(0, s.Length \ 38).Select(Function(i) s.Substring(i * 38, 38))
Dim res = String.Join(vbCrLf, list)
TextBox1.Text = res