string.startsWith()

String.startsWith() Checks the string whether it starts with input string or not.
Syntax
String1.startsWith(String2)
Return value is boolean ( true or false )

Here are some examples with output.
String my_str="plus2net";
		 
System.out.println(my_str.startsWith("plus"));  // true
System.out.println(my_str.startsWith("pl"));  // true
System.out.println(my_str.startsWith("p"));  // true
System.out.println(my_str.startsWith("plus2net"));  // true
System.out.println(my_str.startsWith("PLUS"));  // false
System.out.println(my_str.startsWith("net"));  // false
System.out.println(my_str.startsWith("et"));  // false
This is case sensitive matching of end part of the string.

All String functions
Java


plus2net.com






We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer