Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java code to check if string is alphanumeric

java.util.regex.*;
class AlphanumericExample
{
  public static void main(String...s)
  {
    String s1="adA12", s2="jh@l";
    System.out.println(s1.matches("[a-zA-Z0-9]+"));
    System.out.println(s2.matches("[a-zA-Z0-9]+"));
  }
}
Comment

check character is alphanumeric java

 javaCopypublic class CheckCharAlpha {
    public static void main(String[] args) {

        boolean letterOrDigit = isAlphaNumeric('k');
        System.out.println(letterOrDigit);
    }

    public static boolean isAlphaNumeric(char char1) {
        return (char1 >= 'a' && char1 <= 'z') || (char1 >= 'A' && char1 <= 'Z') || (char1 >= '0' && char1 <= '9');
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to set title in center in toolbar in android 
Java :: android hide system bar programmatically 
Java :: java stream order by property 
Java :: java system.out.print two dimensional array 
Java :: What is null mean in java 
Java :: convert java to kotlin online editor 
Java :: get month from int java 
Java :: java version 
Java :: how to set list data to android spinner 
Java :: java int to double 
Java :: java find time between two dates 
Java :: lombok gradle dependency spring boot 
Java :: Java JPanel set background color 
Java :: play sound in java 
Java :: java 16 raspberry pi 
Java :: Calculator Program in Java. 
Java :: how to access variable from another class in java 
Java :: java random uuid 
Java :: generate random color in java in android 
Java :: android localdatetime 
Java :: change button text java 
Java :: datetimeformatter for java 
Java :: java get file from url 
Java :: declare hashmap java 
Java :: javafx resizable window 
Java :: java list contains object with property 
Java :: if number is negative java 
Java :: android studio change image on button click 
Java :: Java make digit numbers 
Java :: containskey in java 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =