Fixed bug that would leave + with no symbols option

This commit is contained in:
2022-01-04 02:47:34 -05:00
parent 97f1cd4ad6
commit f7d2f088de
3 changed files with 7 additions and 6 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}