Convert string in lowercase and avoid spaces in c#
string txt = " i am a string Am I U ";//User entry
txt=txt.Trim(); //avoid first and lost spaces
txt = txt.ToLower();//convert all sentence in lower case
txt = txt.Replace(" ", "");// avoid spaces
txt=txt.Trim(); //avoid first and lost spaces
txt = txt.ToLower();//convert all sentence in lower case
txt = txt.Replace(" ", "");// avoid spaces
Comments
Post a Comment