sapling/eden/fs/utils/String.cpp
Mark Shroyer bd8b347dc7 Hostname normalization C++ implementation and test cases
Reviewed By: xavierd

Differential Revision: D46300186

fbshipit-source-id: f4784e03eb8d2f055db2015ee326ae24bc63de26
2023-06-12 16:59:17 -07:00

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