Diablicolic Posted August 20, 2003 Posted August 20, 2003 I have this problem with a string, you see it always seems to come out like something like this: hhheeellllloooooo And I was wondering if there was a way to like delete the extras so that it would come out looking like this: helo :) Quote "Reality is fake, Dreams are for real"
*Experts* Volte Posted August 20, 2003 *Experts* Posted August 20, 2003 You could do this:for (int i = 0; i <= 26; i++) { String lc = Convert.ToChar(i + 97).ToString(); String uc = Convert.ToChar(i + 65).ToString(); // Replace twice so that triplets are reduced to 1: // 1) aaaaaa -> aaaa // 2) aaaa -> a myText = myText.Replace(lc + lc, lc).Replace(lc + lc, lc); myText = myText.Replace(uc + uc, uc).Replace(uc + uc, uc); }A bit hackish I suppose, but it should work (I haven't tested it though). Quote
Administrators PlausiblyDamp Posted August 20, 2003 Administrators Posted August 20, 2003 Where is the string coming from, and would you have any control over the source? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.