src/ufo/utils/dataextractor/DataExtractorCSVBackend.cc
size_t findPayloadColumn(const std::vector<std::string> &columnNames,
                         const std::string &payloadGroup) {
  const std::string prefix = payloadGroup + '/';
  const std::string suffix = '@' + payloadGroup;
  auto isInPayloadGroup = [&prefix, &suffix](const std::string &name) {
    return eckit::StringTools::beginsWith(name, prefix) ||
           eckit::StringTools::endsWith(name, suffix);
  };
  auto payloadColumnIt = std::find_if(columnNames.begin(), columnNames.end(), isInPayloadGroup);
  if (payloadColumnIt == columnNames.end())
    throw eckit::UserError("No payload column found: no column name begins with '" + prefix +
                           "' or ends with '" + suffix + "'",
                           Here());
  if (std::any_of(payloadColumnIt + 1, columnNames.end(), isInPayloadGroup))
    throw eckit::UserError("Multiple payload candidates found: "
                           "more than one column name begins with '" + prefix +
                           "' or ends with '" + suffix + "'", Here());
  return payloadColumnIt - columnNames.begin();
}
/// \brief Find the index of the column whose name ends with `@` followed by `payloadGroup`
/// or begins with `payloadGroup` followed by `/`.
///
/// Throw an exception if there's no such column or there's more than one.


Throw an exception if there's no such column or there's more than one.
Throw an exception if there ' s no such column or there ' s more than one .
size_t findPayloadColumn(const std::vector<std::string> &columnNames,
                         const std::string &payloadGroup) {
  const std::string prefix = payloadGroup + '/';
  const std::string suffix = '@' + payloadGroup;
  auto isInPayloadGroup = [&prefix, &suffix](const std::string &name) {
    return eckit::StringTools::beginsWith(name, prefix) ||
           eckit::StringTools::endsWith(name, suffix);
  };
  auto payloadColumnIt = std::find_if(columnNames.begin(), columnNames.end(), isInPayloadGroup);
  if (payloadColumnIt == columnNames.end())
    throw eckit::UserError("No payload column found: no column name begins with '" + prefix +
                           "' or ends with '" + suffix + "'",
                           Here());
  if (std::any_of(payloadColumnIt + 1, columnNames.end(), isInPayloadGroup))
    throw eckit::UserError("Multiple payload candidates found: "
                           "more than one column name begins with '" + prefix +
                           "' or ends with '" + suffix + "'", Here());
  return payloadColumnIt - columnNames.begin();
}
size_t findPayloadColumn ( const std :: vector < std :: string > & columnNames , const std :: string & payloadGroup ) { const std :: string prefix = payloadGroup + ' ' ; const std :: string suffix = ' ' + payloadGroup ; auto isInPayloadGroup = [ & prefix , & suffix ] ( const std :: string & name ) { return eckit :: StringTools :: beginsWith ( name , prefix ) || eckit :: StringTools :: endsWith ( name , suffix ) ; } ; auto payloadColumnIt = std :: find_if ( columnNames . begin ( ) , columnNames . end ( ) , isInPayloadGroup ) ; if ( payloadColumnIt == columnNames . end ( ) ) throw eckit :: UserError ( " " + prefix + " " + suffix + " " , Here ( ) ) ; if ( std :: any_of ( payloadColumnIt + 1 , columnNames . end ( ) , isInPayloadGroup ) ) throw eckit :: UserError ( " " " " + prefix + " " + suffix + " " , Here ( ) ) ; return payloadColumnIt - columnNames . begin ( ) ; }
\brief Find the index of the column whose name ends with `@` followed by `payloadGroup`
or begins with `payloadGroup` followed by `/`.
\ brief Find the index of the column whose name ends with ` @ ` followed by ` payloadGroup ` or begins with ` payloadGroup ` followed by ` / ` .