A polyfill for ES6 new String method