Removing them from what? strings? buffer text? Where have you searched for an answer before coming here?
– StefanJun 22 '17 at 16:30

Please clarify if you are looking for a function that deletes trailing whitespace from a buffer (as @Ryan's answer addresses), or if you're looking to remove whitespace from a string, or something else.
– Dan♦Jun 23 '17 at 13:04

1 Answer
1

According to the EmacsWiki, M-x delete-trailing-whitespace will eliminate all trailing whitespace in a buffer. In Spacemacs, it is bound to SPC x d w by default

You can do it automatically for all buffers by adding the following to your init.el:

(add-hook 'before-save-hook 'delete-trailing-whitespace)

For future reference, you can search for Emacs functions within Emacs by typing M-x apropos, then typing your query. In this case, M-x apropos <RET> whitespace <RET> provides a list of functions relating to whitespace.