sqlQuery.Replace("S", "");
this "Replace" for some weird reason doesn't work!!! I tried debegging this in "command window". and here's the message from the command window:
? sqlQuery.Replace("as", "bas")
I have included "System" in my code -> "using System;". I have tried:
string and String... I'm all out of ideas... what am I missing??
thanx in advance!
AnttiPosted Feb 11, 2006, 8:46 AM
That is because that the contents of a string object cannot be altered. When you replace some characters using Replace -method, you can see that the method returns a string, that is a altered copy of the original. All operations of the System.String-class work the same way.
If you want to have a "alterable" string, you can use System.Text.StringBuilder class. Its contects can be direclty changed, thus it is more efficient in those cases, when you need to do lots of string manipulation.
SolitairePosted Feb 10, 2006, 11:24 AM
string sqlQuery = "Some huge automated text";
sqlQuery = sqlQuery.Replace("S", "");