mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
bd8b347dc7
Reviewed By: xavierd Differential Revision: D46300186 fbshipit-source-id: f4784e03eb8d2f055db2015ee326ae24bc63de26
25 lines
583 B
C++
25 lines
583 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "eden/fs/utils/String.h"
|
|
|
|
namespace facebook::eden {
|
|
|
|
std::vector<std::string_view> split(std::string_view s, char delim) {
|
|
std::vector<std::string_view> result;
|
|
std::size_t i = 0;
|
|
|
|
while ((i = s.find(delim)) != std::string_view::npos) {
|
|
result.emplace_back(s.substr(0, i));
|
|
s.remove_prefix(i + 1);
|
|
}
|
|
result.emplace_back(s);
|
|
return result;
|
|
}
|
|
|
|
} // namespace facebook::eden
|