Looking for one C # string code that removes duplicate characters from a string. We did this with a simple lead ahead of the loop, but would like to see a regular expression. Ex. input = "6200032111623451123345666" output = "623262345245"
Thank.
Lyle
What about:
string s = Regex.Replace("6200032111623451123345666", @"(.)\1+", "");
\1+- this is "one or more" (greedy) backreferences to the first capture group, .(any character).
\1+
.
s / (([a-zA-z0-9]) \ 1 +) // g, of course, you need to translate it to C #
Source: https://habr.com/ru/post/1727996/More articles:Are you already using MVC 2 or MVC 1? - S # arp Architectur + Spark View Engine - asp.net-mvcarrayWithObjects: ะะฑัะตะบัั ะดะพะปะถะฝั ะฑััั NSStrings - objective-cHow can CanExecute from the command line come on after removing an item from the visual tree? - wpfDelete semicolon in string using javascript - javascriptHow to write an async class with a minimal amount of re-code? - c #Simple Image Download Libraries - cPyQt + shortcut for launching a button - pythonCannot get .NET XPathNavigator to work - c #NSOutlineView slide animation - objective-cwhy do we use the identifier column in the table if we have a unique value - sqlAll Articles