Computer Science, asked by vikhyat04, 10 months ago

How to find substring of a string in java?

Answers

Answered by ojas2020
0

Answer:

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accept a String and return starting position of the string if it exists, otherwise it will return -1.

Answered by syedmateenmubeen
1

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accept a String and return starting position of the string if it exists, otherwise it will return -1

Similar questions