From f7d2f088dee67a57620ccbee15cfe06e599117f8 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Tue, 4 Jan 2022 02:47:34 -0500 Subject: [PATCH] Fixed bug that would leave + with no symbols option --- src/main/java/mattrixwv/CipherStreamJava/Atbash.java | 5 +++-- src/main/java/mattrixwv/CipherStreamJava/Caesar.java | 4 ++-- src/main/java/mattrixwv/CipherStreamJava/Vigenere.java | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/mattrixwv/CipherStreamJava/Atbash.java b/src/main/java/mattrixwv/CipherStreamJava/Atbash.java index 1ee3b6a..10a13b1 100644 --- a/src/main/java/mattrixwv/CipherStreamJava/Atbash.java +++ b/src/main/java/mattrixwv/CipherStreamJava/Atbash.java @@ -1,7 +1,7 @@ //CipherStreamJava/src/main/java/mattrixwv/CipherStreamJava/Atbash.java //Matthew Ellison // Created: 07-25-21 -//Modified: 12-30-21 +//Modified: 01-04-22 //This is the declaration of the Atbash class package mattrixwv.CipherStreamJava; @@ -25,6 +25,7 @@ public class Atbash{ if(Character.isUpperCase(currentChar)){ letterBase = 'A'; } + //TODO: Test and see if there is a more efficient way to do this output.append((char)(currentChar + 25 - (2 * (currentChar - letterBase)))); } //Keep any punctuation/whitespace the way it is @@ -72,7 +73,7 @@ public class Atbash{ } if(!leaveSymbols){ //Remove all non-alpha numeric and whitespace symbols - input = input.replaceAll("[^a-zA-Z0-9\\s+]", ""); + input = input.replaceAll("[^a-zA-Z0-9\\s]", ""); } //Save the string inputString = input; diff --git a/src/main/java/mattrixwv/CipherStreamJava/Caesar.java b/src/main/java/mattrixwv/CipherStreamJava/Caesar.java index da919ec..0206c21 100644 --- a/src/main/java/mattrixwv/CipherStreamJava/Caesar.java +++ b/src/main/java/mattrixwv/CipherStreamJava/Caesar.java @@ -1,7 +1,7 @@ //CipherStreamJava/src/main/java/mattrixwv/CipherStreamJava/Caesar.java //Matthew Ellison // Created: 07-25-21 -//Modified: 12-30-21 +//Modified: 01-04-22 //This is the declaration of the Caesar class package mattrixwv.CipherStreamJava; @@ -27,7 +27,7 @@ public class Caesar{ inputString = inputString.replaceAll("\\s+", ""); } if(!leaveSymbols){ - inputString = inputString.replaceAll("[^a-zA-Z0-9\\s+]", ""); + inputString = inputString.replaceAll("[^a-zA-Z0-9\\s]", ""); } this.inputString = inputString; } diff --git a/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java b/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java index 10a55cf..c480093 100644 --- a/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java +++ b/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java @@ -1,7 +1,7 @@ //CipherStreamJava/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java //Matthew Ellison // Created: 07-25-21 -//Modified: 12-30-21 +//Modified: 01-04-22 //This is the declaration of the Vigenere class package mattrixwv.CipherStreamJava; @@ -36,7 +36,7 @@ public class Vigenere{ inputString = inputString.replaceAll("\\s+", ""); } if(!leaveSymbols){ - inputString = inputString.replaceAll("[^a-zA-Z0-9\\s+]", ""); + inputString = inputString.replaceAll("[^a-zA-Z0-9\\s]", ""); } this.inputString = inputString; }