Skip to content
Snippets Groups Projects
Commit e62b23a2 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Use StringTokenizer to split string.

parent 27ecd726
No related branches found
No related tags found
Loading
......@@ -144,7 +144,7 @@ template <typename T> int sectionMCNPX(std::string &A, T &out);
MANTID_KERNEL_DLL void writeMCNPX(const std::string &Line, std::ostream &OX);
/// Split tring into spc deliminated components
MANTID_KERNEL_DLL std::vector<std::string> StrParts(std::string Ln);
MANTID_KERNEL_DLL std::vector<std::string> StrParts(const std::string &Ln);
/// Splits a string into key value pairs
MANTID_KERNEL_DLL std::map<std::string, std::string>
......
......@@ -412,11 +412,10 @@ void writeMCNPX(const std::string &Line, std::ostream &OX) {
* @return vector of components
*/
std::vector<std::string> StrParts(const std::string &Ln) {
std::vector<std::string> Out;
std::string Part;
while (section(Ln, Part))
Out.push_back(Part);
return Out;
auto tokenizer = Mantid::Kernel::StringTokenizer(
Ln, " ", Mantid::Kernel::StringTokenizer::TOK_TRIM |
Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
return tokenizer.asVector();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment