Skip to content

Commit f3f3b4a

Browse files
committed
Remove bool param in split(string, bool compress=true).
1 parent 1ed0dc9 commit f3f3b4a

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

include/bitcoin/system/data/string.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ constexpr std::string to_string(const data_slice& bytes) NOEXCEPT
3939
BC_API std::string join(const string_list& tokens,
4040
const std::string& delimiter=ascii_space) NOEXCEPT;
4141

42-
/// Split text into tokens by the specified delimiter(s).
43-
/// Compression removes all but a last empty token (after trimming).
44-
BC_API string_list split(const std::string& text, bool compress=true) NOEXCEPT;
42+
/// Split text into tokens (whitespace default) by the specified delimiter(s).
43+
/// Compression (default) removes all but a last empty token (after trimming).
44+
BC_API string_list split(const std::string& text) NOEXCEPT;
4545
BC_API string_list split(const std::string& text,
4646
const std::string& delimiter, bool trim=true, bool compress=true) NOEXCEPT;
4747
BC_API string_list split(const std::string& text,

src/data/string.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ string_list split(const std::string& text, const std::string& delimiter,
151151
return split(text, string_list{ delimiter }, trim_tokens, compress);
152152
}
153153

154-
string_list split(const std::string& text, bool compress) NOEXCEPT
154+
string_list split(const std::string& text) NOEXCEPT
155155
{
156156
// Splitting is prioritized over trimming, because each token is trimmed.
157157
// So trimming is not an option when splitting on the trim characters.
158-
return split(text, ascii_whitespace, ascii_whitespace, compress);
158+
return split(text, ascii_whitespace, ascii_whitespace, true);
159159
}
160160

161161
bool trim_left(std::string& text, const std::string& token) NOEXCEPT

test/data/string.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ BOOST_AUTO_TEST_CASE(string__split0__true_compress__trimmed_compressed)
142142
{
143143
const std::string value{ "\t\r\n abc " };
144144
const string_list expected{ "abc" };
145-
BOOST_REQUIRE_EQUAL(system::split(value, true), expected);
145+
BOOST_REQUIRE_EQUAL(system::split(value), expected);
146146
}
147147

148148
BOOST_AUTO_TEST_CASE(string__split0__false_compress__trimmed)
149149
{
150150
const std::string value{ " abc \t\r\n" };
151151
const string_list expected{ "abc" };
152-
BOOST_REQUIRE_EQUAL(system::split(value, false), expected);
152+
BOOST_REQUIRE_EQUAL(system::split(value, ascii_whitespace, ascii_whitespace, false), expected);
153153
}
154154

155155
// split1
@@ -589,7 +589,7 @@ BOOST_AUTO_TEST_CASE(string__replace__with_spaces__expected)
589589
BOOST_REQUIRE_EQUAL(replace(value, "c", " "), 2u);
590590
BOOST_REQUIRE_EQUAL(value, expected3);
591591
const string_list expected4{ "def", "", "", "", "", "def" };
592-
BOOST_REQUIRE_EQUAL(split(value, false), expected4);
592+
BOOST_REQUIRE_EQUAL(split(value, ascii_whitespace, ascii_whitespace, false), expected4);
593593
}
594594

595595
// replace_copy

0 commit comments

Comments
 (0)