Click here to Skip to main content
14,984,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I have a field which stores data like
Slno  PrgramName
 1     London  Olympic     2012 


now while selecting that field the value also displays
London  Olympic     2012


But i want to remove extra space
SQL
Replace(PrgramName,'   ','')

not working any Idea ???
Posted
Updated 27-Jul-12 1:26am
v2

C#
public string CollapseBlanks(string s)
{
  string r = "";
  bool blanks = false;

  foreach (char c in s)
  {
    if (c == ' ')
    {
      if (blanks)
        continue;
      else
        blanks = true;
    }
    else
      blanks = false;
    r += c;
  }
  return r;
}
   
v3
Replace(PrgramName," ","")


it will work
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900