replace Letter from a String using Regex - Java java.lang

Java examples for java.lang:String Replace

Description

replace Letter from a String using Regex

Demo Code


//package com.java2s;

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

    public static String replaceLetter(String content) {
        String strMark = "[^[A-Za-z]+$]";
        String strContent = "";
        strContent = content.replaceAll(strMark, "");
        return strContent;
    }
}

Related Tutorials