考试第二题

package test02;

public class Demo {
    
    //给你一组字符串如:iu7i8hy4jnb2,让你编程输出里面的数字:7842

    public static void main(String[] args) {
        
        //先将字符串存入  待会进行提取操作
        String message = "iu7i8hy4jnb2";
        //先把待会要提取的东西 弄出来
        String regex = "i|u|h|y|j|n|b";
        
        System.out.println("提取前:"+message);
        //进行提取操作
        message = message.replaceAll(regex, "");
        
        System.out.println("提取后:"+message);
        
    }
    
    
    
}

猜你喜欢

转载自www.cnblogs.com/bichen-01/p/11335883.html