How to substring string in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to substring string in Java?

I have "sampleInput" string and I need to cut some part of my string. I need start with index 1 and end with my string length. How to get cutted string? Input: understanding Output: nderstanding

3rd Jul 2021, 11:27 AM
a SnowFlake
a SnowFlake - avatar
2 Answers
+ 4
Roman Koteev String str = "time"; str = str.substring(1, str.length()); //ime
3rd Jul 2021, 11:37 AM
A͢J
A͢J - avatar
+ 4
Roman Koteev , it is not quiet clear what your problem is. if you expect a helpful answer please keep in mind: - give a clear and complete task description - add some samples with input and the expected output values thanks for understanding!
3rd Jul 2021, 11:31 AM
Lothar
Lothar - avatar