Split Text if length is more than 125 words include space

I have a column in excel which has text. Those text are very long …
I’m using * text.length * to find the length of currentrow text…

I want that I split my text-- if text.length is >125

My split function is not working … can someone help

@Latif
please provide sample data
what you want to split??

Cheers!!

Hi @Latif

Try this:

Assign activity:
    inputText = "YourLongTextHere" ' Replace this with your actual text
    maxLength = 125

   If inputText.Length > maxLength 
  Then
       firstPart = inputText.Substring(0, maxLength)
       remainingPart = inputText.Substring(maxLength)

      ' Now you can use firstPart and remainingPart as needed
   Else
      ' The text is not longer than the specified length, no need to split
   End If

maxLength is of DataType System.Int32

Hope it helps!!

Hi @Latif

As per my understanding

firstPart = currentRow(“yourColumnName”).ToString.Substring(0, 125)
remainingPart = currentRow(“yourColumnName”).ToString.Substring(125)

Tell me If I am wrong

Hope this helps

Hi @Latif

Assign activity:
    inputText="LoremipsumdolorsitametconsecteturadipisicingelitseddoeiusmodtemporincididuntutlaboreetaliquametmagnaaliquaLoremipsumdolorsitametconsecteturadipisicingelitseddoeiusmodtemporincididuntutlaboreetaliquametmagnaaliqua" \\Replace this with your actual text
    maxLength = 125

   If inputText.Length > maxLength 
  Then
       firstPart = inputText.Substring(0, maxLength)
       remainingPart = inputText.Substring(maxLength)

      ' Now you can use firstPart and remainingPart as needed
   Else
      ' The text is not longer than the specified length, no need to split
   End If

Hope it helps!!

1 Like

Hi @Latif

You can do it directly in assing activity in one go

ResultString = if(SourceString.Length > 125, SourceString.Substring(0, 125), SourceString)

Cheers