Java String Remove removePunctuation(String str)

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

Description

remove Punctuation

License

Open Source License

Declaration

public static String removePunctuation(String str) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static String removePunctuation(String str) {
        char[] chs = str.toCharArray();
        ArrayList<Character> list = new ArrayList<Character>();
        for (int i = 0; i < chs.length; i++) {
            if (Character.getType(chs[i]) == 5) {
                list.add(chs[i]);/* ww w.  j  av  a 2s  .  co m*/
            }
        }
        char[] newchs = new char[list.size()];
        for (int i = 0; i < newchs.length; i++) {
            newchs[i] = list.get(i);
        }
        return new String(newchs);
    }
}

Related

  1. removeModuleReference(String allStr, String refStr)
  2. removeNewLineAndTab(String value)
  3. removePostfixedNewline(String s)
  4. removeProperty(String name)
  5. removePropertyNameModifier(String name)
  6. removePunctuation(String value)
  7. removeRecursive(Object json, String keyToRemove)
  8. removeSomeOne(String words, int count)
  9. removeSpaces(String orig)