mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-07-12 19:01:50 +02:00
minor
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
@ -23,12 +23,12 @@ Split a string using the specified delimeter and return a vector of strings.
|
|||||||
TODO! Look into switching to absl or a string_view based implementation. Current
|
TODO! Look into switching to absl or a string_view based implementation. Current
|
||||||
implementation should not be used in a performance critical place.
|
implementation should not be used in a performance critical place.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> split(const std::string& strToSplit, char delimeter);
|
std::vector<std::string> split(const std::string &strToSplit, char delimeter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Concatenate the non empty strings in the vector using +
|
Concatenate the non empty strings in the vector using +
|
||||||
*/
|
*/
|
||||||
std::string concatenateNonEmptyStrings(const std::vector<std::string>& vec);
|
std::string concatenateNonEmptyStrings(const std::vector<std::string> &vec);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Concatenate strings using + if the strings are different
|
Concatenate strings using + if the strings are different
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
|
#include <sstream>
|
||||||
namespace sls{
|
namespace sls{
|
||||||
|
|
||||||
|
|
||||||
@ -38,4 +38,4 @@ std::string concatenateIfDifferent(std::vector<std::string> container)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
}; // namespace sls
|
@ -45,7 +45,7 @@ TEST_CASE("Concat") {
|
|||||||
REQUIRE(v == v2);
|
REQUIRE(v == v2);
|
||||||
|
|
||||||
SECTION("add a different value"){
|
SECTION("add a different value"){
|
||||||
v.push_back("two");
|
v.emplace_back("two");
|
||||||
REQUIRE(v!=v2);
|
REQUIRE(v!=v2);
|
||||||
REQUIRE( sls::concatenateIfDifferent(v) == "one+one+one+two+");
|
REQUIRE( sls::concatenateIfDifferent(v) == "one+one+one+two+");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user