Java tutorial
//package com.java2s; public class Main { static String dropSpaces(String s) { return (s == null) ? null : s.trim().replaceAll("\\s+", ""); } }