Match any digits or numbers are present, in this case the - Java Language Basics

Java examples for Language Basics:String

Description

Match any digits or numbers are present, in this case the

Demo Code

public class Main {
  public static void main(String[] args) throws Exception {
    String str = "";

    str = "I love Java 8!"; 
    boolean result = str.matches("I love Java [0-9]!"); 
    System.out.println(result); //from  www  . j a  v  a2s  . c  o  m
    
  }
}

Result


Related Tutorials