Name the inbuilt function of Java that is used to find if a given substring is present in another string . Plz give an example .
Java - String Manipulation ( Class 10 )
Bunti360:
There is no such function, But some operations are available !.
Answers
Answered by
9
HEY !!!! HERE IS YOUR ANSWER......
String contains() is the inbuilt function of Java that is used to find if a given substring is present in another string .
For example-
class ContainsExample
{
public static void main(String args[])
{
String name=" hello how are you doing?"; System.out.println(name.contains("how are you")); // returns true System.out.println(name.contains("hello")); // returns true System.out.println(name.contains("fine")); // returns false
}
}
HOPE IT HELPS ^_^
String contains() is the inbuilt function of Java that is used to find if a given substring is present in another string .
For example-
class ContainsExample
{
public static void main(String args[])
{
String name=" hello how are you doing?"; System.out.println(name.contains("how are you")); // returns true System.out.println(name.contains("hello")); // returns true System.out.println(name.contains("fine")); // returns false
}
}
HOPE IT HELPS ^_^
Similar questions