refactor string functions into str.h