sajad torkamani
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        String input = "12345"; // Example string

        // Check if the string contains only digits
        boolean isOnlyDigits = Pattern.matches("\\d+", input);

        System.out.println("Does the string contain only digits? " + isOnlyDigits);
    }
}
Tagged: Java