How to append a string at a specific index in another string

For suppose, I have a string str=“Hello, DisplayName=“Break”” and I want to concatenate another string, say appendstr="Private: " at some specific index in str. How can I do it?

Any suggestion is appreciated. Thanks in advance!!

Hi
Welcome to uipath community
Yah we can do like this
stringvariable.ToString.Insert(your index position, “your new string”)

Where index usually starts from 0 for the first character in the string
Cheers @vamsikrish28

1 Like

There is no function such as Index in uipath.

2 Likes

Aaha that was a typo mistake
It’s Insert

stringvariable.ToString.Insert(your index position, “your new string”)

2 Likes

Please note that string is an atomic data type so you cannot manipulate them internally. You need to reassign your variable with the new value using relevant activities like Assign or Invoke Code. In your case it would be stringVariable = stringVariable.Insert(index, textToBeInserted).

2 Likes

Thank you very much!! It helped me a lot.

2 Likes

Cheers @vamsikrish28

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.