I have a specific question about how to get
Java to look at the data in an array and allow a certain scenario through, but block another.
The assignment is to create a form (swing) that allows the user to input a message, then encode the message into numbers using the ASCII letter equivalent.
For example: the user can input "Hello World" and encode it to numbers 8 5 12 12 15 0 23 15 18 12 4. A "space" is equal to a "0" and it adjusts so that instead of number 65 being A... A is 1, B is 2, C is 3 etc.. Additionally, the
string is converted into all caps right off the bat.
On the other side, the user can input numbers 8,5,12,12,15... etc and get the reverse back to Hello World.
The problem I am left with by the instructor is when a user enters spaces in the numbers such as 8, 5, 12, or accidentally puts a space in between numbers such as 8,5,1 2, 2 7, etc.
It needs to accept a space before or after the number, but not in between..
Below is the method that is doing the Decoding by entering the numbers into an array based on where the comma (",") is in the string, and then adding 64, and converting it into the ASCII letter. Anything other than 0 (space) or 1-26 (alphabet) should present a "?".
So, back to my original problem... How can I get it to look at the data in the array and handle the different possible places for the space? Any assistance would be appreciated.