📜  java从字符串中分离数字 - Java代码示例

📅  最后修改于: 2022-03-11 14:52:21.139000             🧑  作者: Mango

代码示例1
// string contains numbers
        String str = "The price of the book is $49";
        // extract digits only from strings
        String numberOnly = str.replaceAll("[^0-9]", "");
        // print the digitts
        System.out.println(numberOnly);