1 string str = " asdf asd saddf sdfwrqeqw a asdf "; 2 string[] strs = str.Trim().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries); 3 string finallStr = string.Join(" ",strs);