You should find the position in the element where you want to insert the new line character then shift all characters one position right starting from the found position and insert the new line character. If you are dealing with std::string then all you need is to dibd the target position of inserting because shifting the class will do itself.