How to get length of string in Java?

Ads
 

How to get length of string in Java?

What is the method of String for getting the length?

How to get length of string in Java?

Tell me code fast.

Thanks

View Answers

September 12, 2014 at 5:51 AM

Hi,

You may use the following code:

String str= "Good Tutorials";
int length = str.length();

You have to use the str.length() to get the length of a String object.

Thanks

Ads









Related Tutorials/Questions & Answers:
How to get length of string in Java?
String length example
Advertisements
how to get string between two characters
Java2
String length without using length() method in java
how to get string after first occurence of alphanumeric char in java?
Mysql String Length
Mysql String Length
How can I get query string values in JavaScript?
C String length
Java : Length of String
length() Method In Java
String Length
Javah
Get Length of Array
Get Length of Array
Java get Stack Trace as String
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java
Use of <fn:length(String)> Tag of JSTL
Javap Tool application
How to call Array Length for loop in PHP
String st="abc bca cab acb bac cba acb " ; But out put as ab ab ab ab ab ab how to get it?
How to append String in Java?
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
How to split string in Java?
How to Append String In Java?
How to get the Day name
How to convert into to String in Java?
How to get Button Id ?

Ads