Re: Searching char in String
Look at the API doc for the String class. It has methods that will be useful for you.
http://docs.oracle.com/javase/8/docs/api/index.html
If you have some questions about your code, post your code (wrapped in code tags)
and ask you questions.
Re: Searching char in String
public class Matching
{
public static void main(String args[])
{
String str = "pqrpqrpqr";
System.out.println(str.indexOf('r'));
System.out.println(str.indexOf("qrp"));
System.out.println(str.indexOf('u'));
System.out.println(str.lastIndexOf('p'));
System.out.println(str.charAt(3));
System.out.println(str.length());
System.out.println(str.charAt(12));
}
}
Re: Searching char in String
Please edit your post and wrap your code with code tags:
[code]
**YOUR CODE GOES HERE**
[/code]
to get highlighting and preserve formatting.