conditional erasure
This commit is contained in:
@@ -1763,7 +1763,16 @@ diskio::load_csv_ascii(Mat< std::complex<T> >& x, std::istream& f, std::string&
|
||||
std::getline(line_stream, token, ',');
|
||||
|
||||
// remove spaces and tabs
|
||||
token.erase(std::remove_if(token.begin(), token.end(), [](char c) { return ((c == ' ') || (c == '\t')); }), token.end());
|
||||
if(token.length() > 0)
|
||||
{
|
||||
const char c_front = token.front();
|
||||
const char c_back = token.back();
|
||||
|
||||
if( (c_front == ' ') || (c_front == '\t') || (c_back == ' ') || (c_back == '\t') )
|
||||
{
|
||||
token.erase(std::remove_if(token.begin(), token.end(), [](char c) { return ((c == ' ') || (c == '\t')); }), token.end());
|
||||
}
|
||||
}
|
||||
|
||||
const size_t token_len = size_t( token.length() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user