Hyland Interview Question

create a function that returns the first index of a character in a string

Interview Answer

Anonymous

Oct 23, 2017

int charPosn(String str, char ch) { for (int i = 0; i < str.length; i++) { if (str.charAt(i) == ch) return i; } return -1; }