Scala String indexOf() method with example
The indexOf() method is utilized to find the index of the first appearance of the character in the string and the character is present in the method as argument.
Method Definition: int indexOf(int ch)
Return Type: It returns the index of the character stated in the argument.
So, here the first occurrence of ‘i’ is at index one So, 1 is returned as output.