Replace a word using Index number

Hello everyone.

Is it possible to replace a word in document using index number?

For eg: Dear Customer - The 1st Index (Customer) has to be replaced by some other word.

Regards.

Hi @Pranav_Sundar

We can replace it. First we have to split the input data by space then replace the 1st index element with the required data.

Use the below expression

- Assign -> Input = "Dear Customer"
- Assign -> Output = String.Join(" ", Input.Split(" ").Select(Function(s, i) If(i = 1, "Mahesh", s)))

In the above I replaced the 1st index with Mahesh. In the place of Mahesh change the data according to your requirement.

Check the below workflow for better understanding,

Hope it helps!!

1 Like

@mkankatala Thanks a lot.

1 Like

It’s my pleasure. @Pranav_Sundar

Happy Automation!!

Dear @Pranav_Sundar Welcome to the UiPath Community Forum

If you are directly working with the document and replacing it, then you need to follow a human approach → Click on Find & Replace–>Provide input that needs to be searched → Provide input that needs to be altered for the search keyword.

Please remember, if the input that needs to be altered is more than 255 characters, it will throw exception and you need to proceed with Find -->CopyPaste.

Alternate Approach - Use BalaReva Activites Package for word, please follow attach post from @balupad14
BalaReva Word Activites

Thanks

2 Likes

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