Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to find a specific character in a string using array

    public static void main(String[] args) {
        String url = "abc@gmail.com";
        char key = '@';

        char[] ch = url.toCharArray();

        for (int i = 0; i < ch.length; i++) {
            if (key == ch[i]) {
                System.out.println(key + " is in index: "+i);
            }
        }
    }
 
PREVIOUS NEXT
Tagged: #find #specific #character #string #array
ADD COMMENT
Topic
Name
5+8 =