A user selects a song in my mp3 player. He proceeds to rename a song (thus highlighting the "name" column of that given song).
Let's say he pastes in "The\nGreat\nSong". By default, if the string formatter doesn't allow newlines (which is what I want), the app will produce a beep.
How can I process the string before it is pasted? This is what I want: If the string is less than 200 characters long, and if it contains newlines, replace the newlines with spaces before the string actually gets pasted. If it is longer than 200 characters, just do what it would do by default (because I don't want the user accidentally pasting his PhD thesis in there).
How can one do something like that?