Answers for "java using .indexof to fin a space"

0

java using .indexof to fin a space

class Sample{
public static void main(String[] args) {
    String s = "1110 001";
    int index = -1;
    for(int i = 0; i < s.length(); i++ ){
        if(Character.isWhitespace(s.charAt(i))){
            index = i;
            break;
        }
    }

    System.out.println("Required Index : " + index);
}
}
Posted by: Guest on March-22-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language