How to take first x characters of string?


#1

Hi everyone,

I’ve been looking around the forums, and although I have been able to find topics like how to split string into characters, I was not able to adapt their solutions for my slightly different problem: I don’t want to split when encountering a certain character, rather I want to split on encountering a certain character limit. So I want to be able to break it down into say groups of 50 characters or so, I’ve been trying to figure out how to do it but I’m very new to UIPath and have been unable to find a solution. Any help would be greatly appreciated.


#2

Hi.

You can do most things with string manipulation through vb.net in UiPath, so there are various sources out there online to figure out how to do something like this.

One approach would be to use Regex.Matches() to create an array of any character up to certain length

System.Text.RegularExpressions.Regex.Matches("12345678901234567890","(.*){10}").Count.ToString

The above example would split the string by 10 characters using the pattern “(.*){10}”