|
Java - Search for alt or ctrl modifiers in a string
I am writing a program that prompts the user for a sql statement and then executes the statement by sending it to a mysql connection, sort of like the mysql shell.
However, I would like to perform certain actions if the user presses alt-h (or ctrl-h, I don't care which), for example, run a previously entered sql statement or save the current query if the user presses alt-s (or ctrl-s).
My problem is that I don't know how to determine if the string provided by the user contains either alt or ctrl.
Note that, for now, this is a console based application, not a swing based program, therefore, I cannot use KeyListeners, KeyEvents, etc.
How can I determine if a string contains any alt or ctrl modifiers?
|