Get first n
characters of a string using UiPath Studio. In this demo, we will get first two characters of a string and display on the console output.
Add a new Assign activity and initialize the string you want to manipulate. I have used message variable of string datatype.

Add another Assign activity and initialize the integer variable with the value (This value represents, how many characters you want from the string).

Add a Write Line activity to print the first n characters on the console output. We will make use of substring function.
Syntax: String.Substring(startIndex As Integer, length As Integer) As String
Expression: message.Substring(0, n)

Below is what the complete flow looks like.

Console Output

You must be logged in to post a comment.