Skip to content

Commit 7e0ab36

Browse files
committed
Use pre-existing code
1 parent 204f5ca commit 7e0ab36

File tree

2 files changed

+1
-45
lines changed

2 files changed

+1
-45
lines changed

src/Core/IEPlugin/SimpleTextFileToMatrix_Plugin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include <Core/IEPlugin/SimpleTextFileToMatrix_Plugin.h>
4545
#include <Core/Datatypes/DenseMatrix.h>
4646
#include <Core/Datatypes/MatrixTypeConversions.h>
47-
#include <Core/Utils/StringUtil.h>
47+
#include <Core/Utils/Legacy/StringUtil.h>
4848
#include <Core/Logging/LoggerInterface.h>
4949

5050
#include <iostream>

src/Core/Utils/StringUtil.h

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -108,50 +108,6 @@ struct SCISHARE AtomicCounter
108108

109109
SCISHARE bool replaceSubstring(std::string& str, const std::string& from, const std::string& to);
110110

111-
template <class T>
112-
bool from_string(const std::string &str, T &value)
113-
{
114-
std::istringstream iss(str+" ");
115-
iss.exceptions(std::ifstream::eofbit | std::ifstream::failbit | std::ifstream::badbit);
116-
try
117-
{
118-
iss >> value;
119-
return (true);
120-
}
121-
catch (...)
122-
{
123-
return (false);
124-
}
125-
}
126-
127-
//TODO: replace with boost::regex
128-
template <class T>
129-
bool multiple_from_string(const std::string &str, std::vector<T> &values)
130-
{
131-
values.clear();
132-
133-
std::string data = str;
134-
for (size_t j=0; j<data.size(); j++)
135-
if ((data[j] == '\t')||(data[j] == '\r')||(data[j] == '\n')||(data[j]=='"')) data[j] = ' ';
136-
137-
std::vector<std::string> nums;
138-
for (size_t p=0;p<data.size();)
139-
{
140-
while((data[p] == ' ')&&(p<data.size())) p++;
141-
if (p >= data.size()) break;
142-
143-
std::string::size_type next_space = data.find(' ',p);
144-
if (next_space == std::string::npos) next_space = data.size();
145-
T value;
146-
if (from_string(data.substr(p,next_space-p), value)) values.push_back(value);
147-
p = next_space;
148-
149-
if (p >= data.size()) break;
150-
}
151-
if (values.size() > 0) return (true);
152-
return (false);
153-
}
154-
155111
}}
156112

157113
namespace std

0 commit comments

Comments
 (0)