We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a4f3da commit 64ea3ebCopy full SHA for 64ea3eb
src/common/common.h
@@ -79,7 +79,6 @@ namespace xgboost::common {
79
if (str.empty()) {
80
return str;
81
}
82
-
83
auto first = str.find_first_not_of(" \t\n\r");
84
if (first == std::string_view::npos) {
85
return {};
tests/cpp/common/test_common.cc
@@ -44,6 +44,18 @@ TEST(Common, Trim) {
44
auto res = TrimLast(" foo ");
45
ASSERT_EQ(res, std::string_view{" foo"});
46
47
+ {
48
+ auto res = TrimLast(" ");
49
+ ASSERT_EQ(res, std::string_view{});
50
+ }
51
52
+ auto res = TrimFirst(" ");
53
54
55
56
+ auto res = TrimFirst("");
57
58
59
60
61
TEST(Common, Split) {
0 commit comments