USRP Hardware Driver and USRP Manual: string.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
string.hpp
Go to the documentation of this file.
1//
2// Copyright 2022 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
9#include <uhd/config.hpp>
10#include <uhd/exception.hpp>
11
12 namespace uhd { namespace string {
13
24 UHD_API std::pair<std::string, std::string> split(
25 const std::string& str, const std::string& delim)
26{
27 auto delim_pos = str.find(delim);
28 if (delim_pos == std::string::npos) {
29 throw uhd::runtime_error(
30 "Delimiter \"" + delim + "\" not found in string \"" + str + "\"");
31 }
32 return std::make_pair(str.substr(0, delim_pos), str.substr(delim_pos + 1));
33}
34
35}} // 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:133