i have a string i need to extracts letters after 35 letters,i have used substring for this it extracting 0 to last character but in between words like 35 to 40 it is showing error that Index and length must refer to a location within the string. (Parameter ‘length’).Please help
Basically to avoid this error, you should make sure that the length you specify for the substring does not exceed the remaining characters in the string.
Try something like this
str = "This is a sample string that is longer than 35 characters."
startIndex = 35
If str.Length > startIndex Then
' Check if there are enough characters remaining in the string
extractedText = str.Substring(startIndex)
Else
' Handle the case where the string is shorter than 35 characters
extractedText = "String is shorter than 35 characters."
End If
In LogMessage("Extracted Text: " + extractedText)
Hope this helps
Cheers @alan.prakash
strinput=strinput.substring(35)
or
can you share the expression which you have used
cheers
This is just a sample “Hello how are you abcd xyz kjhgsfdk bkjhgty” i need to extract letter after 35 letters or character
Hi @alan.prakash ,
Could you let us know what was the Expression or method used ?
i have used strwords.substring(35,40) like that it is working for (0,42)
Maybe workin with skip, take can solve. We can check, when you share the following
Case A:
Long text sample & expected output
Case B
Short text sample & expected output
Ok i will give sample string
Case A:The quick brown fox jumps over the lazy dog. The dog barks at the fox, but the fox pays no attention. A nearby cat observes the commotion, amused by the spectacle. It yawns and stretches, indifferent to the drama. Meanwhile, a group of birds flies overhead, their cheerful chirping adding to the lively atmosphere. The sun sets in the distance, casting a warm orange glow over the entire scene, creating a picturesque view.
Expected output:After every 35 letters need to split the text and extract
Case B : If it is less than 35 letters no need to split i have solution for that
Thanku so much it is working can u please explain about .Chunk() function
Chunk is LINQ Operator
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
It is creating segments based on the segment size
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.