Repository navigation
Update Caesar.java - #412
Merged
Merged
Conversation
christianbender
requested changes
Apr 11, 2018
christianbender
left a comment
There was a problem hiding this comment.
Good Work! I have some requests.
| // 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.
Instead of this complex if use Character.isLetter(c) see here
Contributor
Author
There was a problem hiding this comment.
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 .
| final int length = encryptedMessage.length(); | ||
| for (int i = 0; i < length; i++) { | ||
| char current = encryptedMessage.charAt(i); | ||
| if (current >= 'A' && current <= 'Z') { |
christianbender
requested changes
Apr 11, 2018
| 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.
Here you can simpler use a switch
Contributor
Author
There was a problem hiding this comment.
thanks for advice here 👍
added 2 commits
April 11, 2018 22:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
changes :-
*fix documentation
*methods (encode,decode) can take any number of shifts now and better performed.