str = ' Salesforce ' Index positions: S(0) a(1) l(2) e(3) s(4) f(5) o(6) r(7) c(8) e(9) * substring(start, end) * Start index inclusive, end index exclusive. * str.substring(0, 5) # characters at indices 0-4 # " Sales " * str.substring(1, 5) # indices 1-4 # " ales " * substr(start, length) * Start index, then number of characters. * str.substr(0, 5) # 5 characters starting at index 0 # " Sales " * str.substr(1, 5) # 5 characters from index 1 # " alesf " So the expressions that return " Sales " are A and C.