How to substring in Java?

Ads
Ads

How to substring in Java?


Java Coder
How to substring in Java?
1 Answer(s)      a year and a month ago
Posted in : Java Beginners
Ads

Hi,

I want to get a part of String in Java.

How to substring in Java?

Thanks

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