RUBY: slice() - ruby on rails
Slicing the string or characters from the given start position with the given length of characters.
Look at the qucik example:
dob = '10/13/1986'
dob_mm = dob.slice(0,2) #this returns 10
dob_dd = dob.slice(2,2) #this returns 13
dob_yy = dob.slice(4,4) #this returns 1986
Look at the qucik example:
dob = '10/13/1986'
dob_mm = dob.slice(0,2) #this returns 10
dob_dd = dob.slice(2,2) #this returns 13
dob_yy = dob.slice(4,4) #this returns 1986