cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove duplicate from String?

Sai
Level 2
Hi,

I have a string Input="225336675992", I need to remove Duplicate number which followed by Other. i need output aas
output="25367592".kindly help me.

------------------------------
Sai
------------------------------
6 REPLIES 6

Devendra_KumarP
Level 7
Hi Sai, 

Use regex expression to remove duplicate numbers.

------------------------------
Devendra Kumar Prajapati
RPA Manager
Infosys
Chandigarh, India
------------------------------
Devendra Kumar Prajapati RPA Manager Infosys Chandigarh, India

Hi Sai,

There are many ways to do this : A code stage , Regular Expression and a logic using Calculation stage and decisions.

I have attached the simple solution using Calculation stages. Remove the .txt from the file name and then import the BP Release. The logic is to extract each character from Input String, store the character in a data item and then compare the current character with the previous one. If the current character doesn't match the previous one, the flow will keep on concatenating and store it in the output data item. Since, the input is a string, it will work for numbers as well as letters or a combination of both. Let me know if you need any help.

------------------------------
Vikrant Sharma
Senior Solution Designer
Blue Prism
------------------------------
Vikrant Sharma Senior Solution Designer Blue Prism

Hi,
I am not able to import that file. please update .bprelease file, that will vey helpful for me.

------------------------------
Hari bp
------------------------------

Hi,

You can use a simple logic as shown below:

27051.png

Here, first I used 'Split Text By Lines' action from 'Utility - Strings' VBO :

27052.png27053.png

Next, I've iterated over the 'Split Values' collection using a Loop stage which has the following values:

27054.png

Next, I have used a decision stage to check if my current character exists in a 'Results' (Text) data item or not which initially would be blank:

27055.png
If the value exists, I simply skip over the iteration otherwise I will add the value to the 'Results' data item:

27056.png

27057.png

At the end of the loop stage, I get the following results:

27058.png

You can find the attached process for more details:


------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hi,

With the risk of stating the obvious, did you try to remove the ".txt" extension from the release file name and then tried to import it? I have anyway attached a .zip for the release if that's not the case.

Also, what's the Blue Prism version you're using? The process was built in 7.0.1 so just checking if you're seeing errors because of a low version of Blue Prism.

------------------------------
Vikrant Sharma
Senior Solution Designer
Blue Prism
------------------------------
Vikrant Sharma Senior Solution Designer Blue Prism

NaveenRPA
Level 4
Hi Sai 

We can remove duplicates from string without using Regex, Object and Code Stage.
See below snapshot i have used only 5 stages and by using Left, Right and Len function we can remove duplicates.
I have attached process you can refer.
//Inside stages code

//Calc stage
//Get First Char, Store in [Temp]
Left([Input], 1)

//Decision Stage
//isCount?
([Count]-1)<Len([Input])

//Decision Stage
//isSame?
[Temp]=Left(Right([Input], Len([Input])-[Count]),1)

//Calc stage
//Append Value, Store in [Unique Number]
[Unique Number]&[Temp]

//Calc stage
//Get Next Char, Store in [Temp]
Left(Right([Input], Len([Input])-[Count]),1)

//Calc stage
//Count++, Store in [Count]
[Count]+1​


27059.png

------------------------------
naveen k
------------------------------