GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Update Caesar.java by cyberkhalil · Pull Request #412 · TheAlgorithms/Java Conversation
|
| // int current = message.charAt(i); //using char to shift characters because ascii is in-order latin alphabet | ||
| char current = message.charAt(i); // Java law : char + int = char | ||
|
|
||
| if (current >= 'A' && current <= 'Z') { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Instead of this complex if use Character.isLetter(c) see here
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Character.isLetter(c) method return true if the input was 'ф' or 'أ' or '褥' while we don't shift them in this method , it's just for shifting Latin letters .
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| final int length = encryptedMessage.length(); | ||
| for (int i = 0; i < length; i++) { | ||
| char current = encryptedMessage.charAt(i); | ||
| if (current >= 'A' && current <= 'Z') { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same thing as above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| int shift = input.nextInt() % 26; | ||
| System.out.println("(E)ncode or (D)ecode ?"); | ||
| char choice = input.next().charAt(0); | ||
| if (choice == 'E' || choice == 'e') { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here you can simpler use a switch
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks for advice here 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.