replace Number using Regex - Java java.util.regex

Java examples for java.util.regex:Match Number

Description

replace Number using Regex

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String content = "java2s.com";
        System.out.println(replaceNumber(content));
    }//from  www  .java2 s.  c  o m

    public static String replaceNumber(String content) {
        String strMark = "[^[0-9]+$]";
        String strContent = "";
        strContent = content.replaceAll(strMark, "");
        return strContent;
    }
}

Related Tutorials