Answers for "how to see if a char is in a string java"

3

how to check if a char is a letter java

Character.isDigit(string.charAt(index)) //(JavaDoc) will return true if it's a digit
Character.isLetter(string.charAt(index)) //(JavaDoc) will return true if it's a letter
Posted by: Guest on July-27-2020
0

check if a string contains a charater java

javaCopyimport java.util.*;
import java.lang.*;
import java.io.*;

public class Example1 {
    public static void main(String[] args) {
        String str = "Character";
        System.out.println(str.contains("h"));
        System.out.println(str.contains("Char"));
        System.out.println(str.contains("ac"));
        System.out.println(str.contains("v"));
        System.out.println(str.contains("vl")); 
    }
}
Posted by: Guest on August-08-2021

Code answers related to "how to see if a char is in a string java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language