Notes

Aside from white space at the beginning and / or end, the actual string will be unaffected. This means too, though, that extraneous spaces within the string -- for instance, a mistaken double-space type -- will not be corrected.

The following will remove all double spaces and leading and trailing spaces.
<lsl>llDumpList2String(llParseString2List(src, [" "], []), " "); //works but can use a large quantity of memory</lsl>

This method does the same thing but may use less memory
<lsl>
//Added By To-mos Codewarrior
string str1 = "some words to remove the spaces from";
integer index;
while(~index=llSubStringIndex(str1," "))
data=llDeleteSubString(str1,index,index);
</lsl>