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")
error: 'sqlQuery.Replace' does not exist
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!
Solitaire85 pointsPosted Feb 10, 2006, 6:24 AM EST
string sqlQuery = "Some huge automated text";
sqlQuery = sqlQuery.Replace("S", "");
AnttiRank #9,295 · 208 pointsPosted Feb 11, 2006, 3:46 AM EST
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.