Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String stripCharFromString(String fullString, char stripChar) {
        String retval = null;
        if (null != fullString) {
            int len = fullString.length();
            // first convert string into a char array
            char[] chars = new char[len];

            try {
                fullString.getChars(0, len, chars, 0);
            } catch (Exception e) {

            }

            int i;
            int j = 0;
            for (i = 0; i < chars.length; i++) {
                if (stripChar != chars[i]) {
                    chars[j] = chars[i];
                    j++;
                }
            }
            retval = new String(chars, 0, j);
        }
        return retval;
    }
}