有空再整理:

1. CString csTemp;

csTemp.Remove(' ');

2. string strTemp;

strTemp.Replace(" ", "");