get_spaces: move to string.js