About 3,650,000 results
Open links in new tab
  1. Java String indexOf () Method - W3Schools

    The indexOf() method returns the position of the first occurrence of specified character (s) in a string. Tip: Use the lastIndexOf method to return the position of the last occurrence of specified character …

  2. Java String indexOf () Method - GeeksforGeeks

    Nov 19, 2024 · In Java, the String indexOf () method returns the position of the first occurrence of the specified character or string in a specified string. In this article, we will learn various ways to use …

  3. Java String indexOf () - Programiz

    The character 'a' occurs multiple times in the "Learn Java" string. The indexOf() method returns the index of the first occurrence of 'a' (which is 2). If the empty string is passed, indexOf() returns 0 …

  4. Java String indexOf () with Examples - HowToDoInJava

    Learn to find the location of a character or substring in a given string and at what index position using the String.indexOf () with examples.

  5. Mastering the `indexOf` Method in Java - javaspring.net

    Nov 12, 2025 · This blog post will provide a comprehensive guide to the `indexOf` method in Java, covering its fundamental concepts, usage methods, common practices, and best practices.

  6. Java String.indexOf () - Baeldung

    Apr 11, 2025 · The method indexOf () returns the first occurrence index of a character or a String in another String. We can pass the index of the character to start searching from.

  7. Java String indexOf () Method - BeginnersBook

    Jul 1, 2024 · Java String indexOf () method is used to find the index of a specified character or a substring in a given String. Here are the different variations of this method in String class:

  8. Java String indexOf Method With Syntax & Code Examples

    Apr 1, 2025 · In this Tutorial, we will learn about the Java String indexOf () Method and its Syntax and Programming Examples to find the Index of Characters or Strings.

  9. Java String indexOf () Method – A Comprehensive Guide

    May 21, 2025 · The indexOf() method in Java searches for a specific character or substring within a String and returns the index position of its first occurrence. If the search is successful, you get a zero …

  10. Applications of String indexOf() Method in Java - GeeksforGeeks

    Jul 23, 2025 · indexOf (String str): This method returns the index within this string of the first occurrence of the specified substring. If it does not occur as a substring, -1 is returned.