Skip to content

Commit 4a4b9b9

Browse files
committed
Removed unnecessary StartsWith, EndsWith utility functions
1 parent 1d329dc commit 4a4b9b9

File tree

4 files changed

+1
-40
lines changed

4 files changed

+1
-40
lines changed

cpp/src/arrow/engine/simple_extension_type_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class SimpleExtensionType : public ExtensionType {
111111
void Fail() { params_ = std::nullopt; }
112112

113113
void Init(std::string_view class_name, std::string_view repr, size_t num_properties) {
114-
if (!::arrow::internal::StartsWith(repr, class_name)) return Fail();
114+
if (!repr.starts_with(class_name)) return Fail();
115115

116116
repr = repr.substr(class_name.size());
117117
if (repr.empty()) return Fail();

cpp/src/arrow/util/string.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ ARROW_EXPORT Status ParseHexValues(std::string_view hex_string, uint8_t* out);
5252

5353
namespace internal {
5454

55-
/// Like std::string_view::starts_with in C++20
56-
inline bool StartsWith(std::string_view s, std::string_view prefix) {
57-
return s.starts_with(prefix);
58-
}
59-
60-
/// Like std::string_view::ends_with in C++20
61-
inline bool EndsWith(std::string_view s, std::string_view suffix) {
62-
return s.ends_with(suffix);
63-
}
64-
6555
/// \brief Split a string with a delimiter
6656
ARROW_EXPORT
6757
std::vector<std::string_view> SplitString(std::string_view v, char delim,

cpp/src/arrow/util/string_test.cc

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -170,34 +170,6 @@ TEST(SplitString, LimitZero) {
170170
EXPECT_EQ(parts[2], "c");
171171
}
172172

173-
TEST(StartsWith, Basics) {
174-
std::string empty{};
175-
std::string abc{"abc"};
176-
std::string abcdef{"abcdef"};
177-
std::string def{"def"};
178-
ASSERT_TRUE(StartsWith(empty, empty));
179-
ASSERT_TRUE(StartsWith(abc, empty));
180-
ASSERT_TRUE(StartsWith(abc, abc));
181-
ASSERT_TRUE(StartsWith(abcdef, abc));
182-
ASSERT_FALSE(StartsWith(abc, abcdef));
183-
ASSERT_FALSE(StartsWith(def, abcdef));
184-
ASSERT_FALSE(StartsWith(abcdef, def));
185-
}
186-
187-
TEST(EndsWith, Basics) {
188-
std::string empty{};
189-
std::string abc{"abc"};
190-
std::string abcdef{"abcdef"};
191-
std::string def{"def"};
192-
ASSERT_TRUE(EndsWith(empty, empty));
193-
ASSERT_TRUE(EndsWith(abc, empty));
194-
ASSERT_TRUE(EndsWith(abc, abc));
195-
ASSERT_TRUE(EndsWith(abcdef, def));
196-
ASSERT_FALSE(EndsWith(abcdef, abc));
197-
ASSERT_FALSE(EndsWith(def, abcdef));
198-
ASSERT_FALSE(EndsWith(abcdef, abc));
199-
}
200-
201173
TEST(RegexMatch, Basics) {
202174
std::regex regex("a+(b*)(c+)d+");
203175
std::string_view b, c;

cpp/src/parquet/arrow/schema.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ using arrow::FieldVector;
4949
using arrow::KeyValueMetadata;
5050
using arrow::Status;
5151
using arrow::internal::checked_cast;
52-
using arrow::internal::EndsWith;
5352
using arrow::internal::ToChars;
5453

5554
using ArrowType = arrow::DataType;

0 commit comments

Comments
 (0)