halo guys,
i have a code like this,
String s="Deepak is working in ACSL";
s.Replace("acsl","Prodigy");
when i execute the above code the "ACSL" in String "s" is not getting replaced with Prodigy.Only when i do like below it gets replaced.
s.Replace("ACSL","Prodigy");
Also
s.Contains("AcSl")
returns false
But how to achieve the previous one.
Kindlly help me in achieving this.
All replies are appreciated
Johnny GCPosted Jun 20, 2008, 2:30 AM
string.Replace() is a function, thus you must assign it back to s:
String s="Deepak is working in ACSL";
s = s.Replace("acsl","Prodigy");
Jan MontanoPosted Jun 20, 2008, 1:01 AM
static void Test2()
{
string s = "Deepak is working in ACSL";
bool result = s.ToUpper().Contains("ACSL"); // = true
}