Loading...
Searching...
No Matches
string.hpp
Go to the documentation of this file.
//
// Copyright 2022 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/exception.hpp>
namespace uhd { namespace string {
UHD_API std::pair<std::string, std::string> split(
const std::string& str, const std::string& delim)
{
auto delim_pos = str.find(delim);
if (delim_pos == std::string::npos) {
throw uhd::runtime_error(
"Delimiter \"" + delim + "\" not found in string \"" + str + "\"");
}
return std::make_pair(str.substr(0, delim_pos), str.substr(delim_pos + 1));
}
}} // namespace uhd::string
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
exception.hpp
uhd::string
Definition string.hpp:12
uhd::string::split
UHD_API std::pair< std::string, std::string > split(const std::string &str, const std::string &delim)
Definition string.hpp:24
uhd
Definition build_info.hpp:12
uhd::runtime_error
Definition exception.hpp:132