Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Obj-c

Idiom #47 Extract string suffix

Create string t consisting in the 5 last characters of string s.
Make sure that multibyte characters are properly handled.

The end of the string s
@import Foundation;
NSString *t=[s substringFromIndex:s.length-5];
(let [t (clojure.string/join (take-last 5 s))])

New implementation...