merge internal and user of charat & substr into one