Hi,
check whether the following code helps you...
rgrds
String s = new String("abc def");
char[] ca = s.toCharArray();
int iStrLen = s.length();
char[] CResultArr = new char[iStrLen + 1];
int j = 0;
for ( int i=0; i< iStrLen; i++ ) {
switch ( ca[i] ) {
case ' ':
break;
default:
CResultArr[j] = ca[i];
j++;
break;
} // end switch
} // end for
s = new String (CResultArr);
System.out.println(s);
|