F# - Remove duplicate characters after first in string
问题 What I am trying to do is to remove duplicates of a specific given char in a string but letting the first char to remain. I.e: let myStr = "hi. my .name." //a function that gets a string and the element to be removed in the string someFunc myStr "." where someFunc returns the string showen as below: "hi. my name" It is easy to remove duplicates from a string, but is there a way to remove the duplicates but letting the first duplicated element remain in the string? 回答1: Here's one approach: