How to Remove duplicates from the string

Hi,

I have this input String “225336675992”
Desired output is “25367592”

How to remove the duplicates from single string.

Regards,

input String “225336675992”
Desired output is “25367592”

Desired output contains duplicates such as 2 and 5 i think you want to remove adjacent repeatative numbers right? So a number should not be followed by itself again?


a is input string
b is output string
Try this
cheers!

1 Like

Hi @Deeksha

Try this

inputString = "225336675992"
outputString = New String(inputString.Distinct().ToArray())

Cheers!!

3 Likes

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