Erase line of text from textfield

how do you erase last line of text from a multiline dynamic textfield, or last couple of lines?