How to get length of string in Java?

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









Related Tutorials/Questions & Answers:
How to get length of string in Java?
String length example
Advertisements
difference between java5 and java6 - Java Beginners
PHP String Length
Java2
String length without using length() method in java
about java1
Mysql String Length
Mysql String Length
Java : Length of String
C String length
generating unique combinations of length of x in a string of length l
String Length
String length property example
how to get string between two characters
Javah
PHP Get Array Length
length() Method In Java
Use of string-length() function in XPath
Get Length of Array
javaa swings - IDE Questions
Get Length of Array
Javap Tool application
About Java2
how to get string after first occurence of alphanumeric char in java?
How can I get query string values in JavaScript?
PHP get character from String
Use of <fn:length(String)> Tag of JSTL
javab - Java Beginners
javas - JSP-Servlet
How to call Array Length for loop in PHP
To get the String between two strings
ModuleNotFoundError: No module named 'javax'
ModuleNotFoundError: No module named 'javax'
Java get Stack Trace as String
javax. servlet.Servlet Exception: Initialization failed, Unable to get DB connection - JSP-Servlet
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
Maven dependency for com.gooddata - gooddata-http-client version 1.0.0+java7 is released. Learn to use gooddata-http-client version 1.0.0+java7 in Maven based Java projects
Mysql Length Function
Mysql Length Function
Artifacts of javax
Java get Int from String
How to append String in Java?
Javah -  Header File Generator
SQL Length Function
Get Character from String
How to trim string till indexof the string
php array length property
How to split string in Java?

Ads