About 22,500,000 results
Open links in new tab
  1. Searching For Characters and Substring in a String in Java

    Jul 23, 2025 · Efficient String manipulation is very important in Java programming especially when working with text-based data. In this article, we will explore essential methods like indexOf (), …

  2. java - How can I check if a single character appears in a string ...

    Feb 3, 2009 · In Java is there a way to check the condition: "Does this single character appear at all in string x" without using a loop?

  3. Java: Finding a Character in a String - javaspring.net

    Jul 25, 2025 · Understanding how to efficiently find a character in a string is crucial for Java developers to write robust and performant code. In this blog post, we will explore the …

  4. String Searching Methods in Java

    Java provides several methods to search within strings, each suited for different needs. The contains() method checks for the presence of a substring, while indexOf() and lastIndexOf() …

  5. Searching characters and substring in a String in Java

    Sep 14, 2020 · Here, a string is defined, and a CharSequence instance is created. The ‘contains’ function associated with the string is used to check if the original string contains the specific …

  6. Searching for a Character or a Substring within a String

    The String class provides two accessor methods that return the position within the string of a specific character or substring: indexOf and lastIndexOf. The indexOf method searches …

  7. Manipulating Characters in a String (The Java™ Tutorials - Oracle

    The String class provides accessor methods that return the position within the string of a specific character or substring: indexOf() and lastIndexOf(). The indexOf() methods search forward …

  8. Java: How to search for a char variable in a string?

    Feb 20, 2013 · I need to find the position of char values that are derived from the user's input. But the indexOf method does not seem to work when I don't provide exact characters to look for.

  9. Java Program to Get a Character from a String - GeeksforGeeks

    Jul 29, 2024 · Copy the element at specific index from String into the char [] using String.getChars () method. Get the specific character at the index 0 of the character array.

  10. How to search a character in a string in Java - StackHowTo

    Jun 8, 2021 · I n this tutorial, we are going to see how to search for a word or a character in a string in Java. In the following example, we’ll use the indexOf () method which returns the …