If 35 th character lies mid of the word. We need to omit that word in first line and we need to add that full word in second line

My code working fine for only one single word, it should work for all words. If the character lies mid of the word.
Example :
Learning uipath rpa concepts like web auto recording email pdf excel = Input string
Learning uipath rpa concepts like w => splitting first 35 characters
eb auto recording email pdf excel => remaining characters from input string
Final output should be web and that has to be written in new line.

Hi @lakshmi.mp ,

Could you give this a try?

image

First half->

If(str_variable(35).ToString.Equals(" "),str_variable.Substring(0,35),str_variable.Substring(0, str_variable.Substring(0,35).LastIndexOf(" ")))

Second half->

Split(str_variable,str_firstHalf).Last().Trim()

SplittingStrings.xaml (5.1 KB)

Kind Regards,
Ashwin A.K

Hi,

Another solution:

strTemp = System.Text.RegularExpressions.Regex.Replace(yourString,"\S+",Function(m) if(m.Index<35 AndAlso m.Index+m.Value.Length>=35,vbcrlf+m.Value,m.Value))
result = System.Text.RegularExpressions.Regex.Replace(strTemp,"^.*",Function(m) if (m.Value.Length>35,m.Value.Substring(0,35)+vbcrlf+m.Value.Substring(35),m.Value))

Regards,

Thank you so much.