remove whitespace from beginning string use replace() code example Example: java remove double spaces StringUtils.normalizeSpace(string);