Re: Manipulating Strings
- To: mathgroup at smc.vnet.net
- Subject: [mg28315] Re: Manipulating Strings
- From: "Stephen P Luttrell" <luttrell at signal.dra.hmg.gb>
- Date: Wed, 11 Apr 2001 02:00:55 -0400 (EDT)
- References: <9ajmoi$sav@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
StringReplace["CLKJLDiCXLklJDMXLKJdLmxLLLEIKXMDLKJcMDLKJXMeNNlB", {"LLL" -> "L", "NN" -> "N"}] produces the output "CLKJLDiCXLklJDMXLKJdLmxLEIKXMDLKJcMDLKJXMeNlB" "Brian Higgins" <bghiggins at ucdavis.edu> wrote in message news:9ajmoi$sav at smc.vnet.net... > Dear Math group, > > I have a string with runs of repeated characters and want to replace > sequences of repeated characters with a single character. For example > consider the string > > "CLKJLDiCXLklJDMXLKJdLmxLLLEIKXMDLKJcMDLKJXMeNNlB" > Thus I want a function that will take the groups "LLL" and "NN" in the > above string and replace them with "L" and "N". >...