In this section, you will learn how to check the given string that start from the specified character in java. The following program checks the started string with "Wel". If you use startsWith() function it will return 'true' and display a message "The given string is start with Wel" otherwise it will show "The given string is not start with Wel".
Description of code:
This is a Boolean type method that returns either 'true' or 'false'. It checks the given string that begins with specified string in the beginning. It takes a string type parameter such as:
start: This is the string that starts.
Here is the code of program:
Output of program:
String start with example!
Given String : Welcome to RoseIndia
Start with : Wel
The given string is start with Wel
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: March 13, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles