Android String Remove removeSpace(String str)

Here you can find the source of removeSpace(String str)

Description

remove Space

Declaration

public static String removeSpace(String str) 

Method Source Code

//package com.java2s;

import android.text.TextUtils;

public class Main {

    public static String removeSpace(String str) {

        if (!TextUtils.isEmpty(str)) {
            return str.trim().replaceAll(" ", "");
        } else {//from  ww w.  jav  a 2s.  c om
            return str;
        }
    }

    public static boolean isEmpty(String str) {
        if (str == null || "".equals(str))
            return true;

        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
                return false;
            }
        }
        return true;
    }
}

Related

  1. removeAccents(String string)
  2. removeBackslashes(String content)
  3. removeDuplicates(String[] first, String[] second)
  4. removeSuffix(String str, String suffix)
  5. removeWhitespace(String str)
  6. rmvSpace(String baseStr)
  7. rmvSpecial(String baseStr)