c# - Is there a better way than String.Replace to remove backspaces from a string? -


I have read the string from another source such as "\ b \ bfoo \ bx" In this case, the word "fox ", As the first 2 \ b is ignored, and the last 'o' is erased, and then replaced with 'x'. Apart from this, one more case would be "pat" to be translated "afu"

I use the string Come on with something. Change it, but it is complicated and I am worried that it is not working properly, it is creating a lot of new string objects which I would like to save.

Any thoughts?

Perhaps the easiest iterate over the whole string is to look at your input, following code 1-pass

  Change the public string is the placepace (string hackspace) {if (string.IsNullOrEmpty (hibbyspace)) is backspace in return; Stringbiller result = new stringbirder (hibiscspace lang); Foreign currency (four c in the hackpack) {if (c == '\ b') {if (result.Length & gt; 0) results. Long--; } And {results. Append (c); }} Return result. Toasting (); }  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -