strlen and substr, and use array for functions