How to substring in Java?

Ads

 
 

Share on Google+Share on Google+

Java Coder
How to substring in Java?
1 Answer(s)      4 months and 4 days ago
Posted in : Java Beginners

Hi,

I want to get a part of String in Java.

How to substring in Java?

Thanks

Ads
View Answers

April 16, 2017 at 11:04 PM


HI,

Hi you can use the substring() method of Java for getting a part of string based on the index number passed to substring() function.

Here is an example:

String string = "Deepak Kumar"; 
String substring = string.substring(3);

Check more example at Taking Substring.

Thanks


Ads