Update template.js

add many methods, do more similar but involved than native implemented string