string.length()

String.length() Returns the length of the string in integer.
Syntax
String1.length()
The output is an integer.

Here are some examples with output.
String str = "plus2net";  
System.out.println(str.length()); // 8
System.out.println("Welcome to ".length()); // 11 
We can list out all the chars of a sting by using for loop
String str = "plus2net";  
for(int i=0;i<str.length();i++) {
	System.out.println(str.charAt(i));
}
Output
p
l
u
s
2
n
e
t
We used charAt() to get the Char at the position.

All String functions
Java

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com






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