diff options
Diffstat (limited to 'runtimes/libs/misc/include/misc/string_helpers.h')
-rw-r--r-- | runtimes/libs/misc/include/misc/string_helpers.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/runtimes/libs/misc/include/misc/string_helpers.h b/runtimes/libs/misc/include/misc/string_helpers.h new file mode 100644 index 000000000..57d0006b0 --- /dev/null +++ b/runtimes/libs/misc/include/misc/string_helpers.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file string_helpers.h + * @ingroup COM_AI_RUNTIME + * @brief This file contains helper functions for std::string + */ + +#include <string> +#include <sstream> +#include <vector> + +namespace nnfw +{ +namespace misc +{ + +inline std::vector<std::string> split(const std::string &s, char delim) +{ + std::stringstream ss(s); + std::string item; + std::vector<std::string> elems; + while (std::getline(ss, item, delim)) + { + elems.push_back(std::move(item)); + } + return elems; +} + +} // namespace misc +} // namespace nnfw |