Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   shift key escape sequence (http://www.programmingforums.org/showthread.php?t=15324)

hbe02 Mar 5th, 2008 7:47 AM

shift key escape sequence
 
is there an escape sequence to be entered in a string that would perform the functionality of the shift key.
in other words, is there a sequence XX such that "XYa" = "A" or "XY4" = "$"
thanks.

Sane Mar 5th, 2008 8:34 AM

Re: shift key escape sequence
 
I believe the shift keys are ordinal values 14/15 or so. It probably varies between Windows and Linux too. If you were to use them as a sequence to literally shift before a character, it might be something like printf("%ca", 15). But, as far as I know, that does not work.

Why not use a prebuilt function for capitalizing letters? What do you need to do this for anyways?

lectricpharaoh Mar 5th, 2008 9:05 PM

Re: shift key escape sequence
 
Have you checked Sun's Java API documentation? You can do what you want by using the Robot class to simulate input. It does come with some caveats, but it should get you started. Note that you'll need to simulate press and release events. For the virtual key codes used in Java, see the KeyEvent class.

If all you want to do is map lowercase letters to their uppercase counterparts, you can use a lookup table, switch() block, or the Java API methods to accomplish this (things like String.toUpperCase() and similar methods).


All times are GMT -5. The time now is 11:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC