-1

Please can anyone advise me on how i can replace a particular character from a 2 mb string without using replace function in .NET

Thanks

5
  • 3
    You can use a StringBuilder or unsafe code. Be more specific about what you're trying to do. Commented Dec 10, 2010 at 8:47
  • 3
    why don't you want to use replace function? Commented Dec 10, 2010 at 8:47
  • well, i knw replace is the best way to do it but i am after exploring more options/ways to do it Commented Dec 10, 2010 at 8:48
  • 1
    Because replace function creates a new string; string is immutable. @Gabe is right, use StringBuilder. Commented Dec 10, 2010 at 8:49
  • 1
    please refer this link , it has a good comparison between the 'replace' functions blogs.msdn.com/b/debuggingtoolbox/archive/2008/04/02/… Commented Dec 10, 2010 at 8:53

1 Answer 1

1

You should have a look at some of the solutions discussed here:

Memory Efficiency and Performance of String.Replace .NET Framework

It mentions the use of Regex.Replace and StringBuilder.Replace

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.