Update Caesar.java
This commit is contained in:
parent
9060d2da29
commit
ca8f6dbb38
@ -34,12 +34,12 @@ public class Caesar {
|
|||||||
// int current = message.charAt(i); //using char to shift characters because ascii is in-order latin alphabet
|
// 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
|
char current = message.charAt(i); // Java law : char + int = char
|
||||||
|
|
||||||
if (current >= 'A' && current <= 'Z') {
|
if (IsCapitalLatinLetter(current)) {
|
||||||
|
|
||||||
current += shift;
|
current += shift;
|
||||||
encoded += (char) (current > 'Z' ? current - 26 : current); // 26 = number of latin letters
|
encoded += (char) (current > 'Z' ? current - 26 : current); // 26 = number of latin letters
|
||||||
|
|
||||||
} else if (current >= 'a' && current <= 'z') {
|
} else if (IsSmallLatinLetter(current)) {
|
||||||
|
|
||||||
current += shift;
|
current += shift;
|
||||||
encoded += (char) (current > 'z' ? current - 26 : current); // 26 = number of latin letters
|
encoded += (char) (current > 'z' ? current - 26 : current); // 26 = number of latin letters
|
||||||
|
Loading…
Reference in New Issue
Block a user