Logo

Programming-Idioms

History of Idiom 38 > diff from v40 to v41

Edit summary for version 41 by programming-idioms.org:
[Java] Fix comments

Version 40

2016-09-20, 16:14:42

Version 41

2016-10-19, 21:18:34

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Illustration

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Illustration
Code
String t = s.substring(i,j);
Code
String t = s.substring(i,j);
Comments bubble
Throws IndexOutOfBoundsException if i is negative, or j is larger than the length s, or i is larger than j.
Comments bubble
Throws IndexOutOfBoundsException if i is negative, or j is larger than the length of s, or i is larger than j.
Demo URL
http://ideone.com/R8U6Pv
Demo URL
http://ideone.com/R8U6Pv