commit 2e08a8c2c8576040fb546538ded78e69a071c7cb
parent 7c0c4c9cd1966a7ab9a4832463d9bedf0b8c2974
Author: Adam Malone <1319733+freddyz@users.noreply.github.com>
Date: Fri, 26 Oct 2018 20:11:13 -0500
dtpulse returns 0 if there are no number characters
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp
@@ -4,7 +4,11 @@ std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
std::vector<int> parseEntireString(std::string input,std::string lookup) {
std::vector<int> absoluteSequence;
absoluteSequence.resize(0);
- if(input.empty()) {
+ bool noNumbers = true;
+ for(int i = 0; i < input.length(); i++) {
+ noNumbers= noNumbers && (lookup.find(input[i]) == std::string::npos);
+ }
+ if(input.empty() || noNumbers) {
absoluteSequence.push_back(0);
return absoluteSequence;
}
@@ -126,4 +130,4 @@ std::string hashExpand(std::string input, int hashnum) {
}
}
return output;
-}
-\ No newline at end of file
+}
diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp
@@ -9,4 +9,4 @@ std::vector <int> parseDt(std::string input, int offset, std::string lookup);
std::vector<int> parseEntireString(std::string input,std::string lookup);
void printVector(std::vector <int> intVector);
std::string hashExpand(std::string input, int hashnum);
-std::string atExpand(std::string input, int atnum, std::string lookup);
-\ No newline at end of file
+std::string atExpand(std::string input, int atnum, std::string lookup);