remove Space from String using Regex - Android java.util.regex

Android examples for java.util.regex:Blank Remove

Description

remove Space from String using Regex

Demo Code


//package com.java2s;

import android.text.TextUtils;

public class Main {
    private static String removeSpaceString(final String inputString) {
        if (inputString == null) {
            return null;
        }/* ww  w . jav  a 2  s. com*/

        String outputString = inputString.replaceAll("\\s", "");
        if (TextUtils.isEmpty(outputString)) {
            return null;
        }

        return outputString;
    }
}

Related Tutorials