Logo

Programming-Idioms

History of Idiom 38 > diff from v59 to v60

Edit summary for version 60 by OC:
New Obj-C implementation by user [OC]

Version 59

2020-10-10, 12:54:10

Version 60

2020-10-10, 22:59:17

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
Variables
t,i,j,s
Variables
t,i,j,s
Imports
@import Foundation;
Code
t=[s substringWithRange:NSMakeRange(i,j-i)]
Comments bubble
A range contains the initial index and the length of the part needed