remove Character from String - Java java.lang

Java examples for java.lang:String Replace

Description

remove Character from String

Demo Code


//package com.java2s;

public class Main {
    public static String removeCharacter(String ret, char c) {
        String retu = "";
        for (int i = 0; i < ret.length(); i++) {
            if (ret.charAt(i) != c) {
                retu += ret.charAt(i);//from w w  w .j  a v a  2s .c om
            }
        }
        return retu;
    }
}

Related Tutorials