From 05627b6f45f94c2aeb2e7c697f1cf61687faf4d8 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 6 Apr 2025 10:16:24 -0400 Subject: [PATCH] AK: Remove unused ByteString titlecase/invert case conversions --- AK/ByteString.cpp | 10 ---------- AK/ByteString.h | 2 -- AK/StringUtils.cpp | 14 -------------- AK/StringUtils.h | 1 - 4 files changed, 27 deletions(-) diff --git a/AK/ByteString.cpp b/AK/ByteString.cpp index 2f4d87ca32a..ef4cdb3487d 100644 --- a/AK/ByteString.cpp +++ b/AK/ByteString.cpp @@ -371,16 +371,6 @@ ByteString ByteString::to_snakecase() const return StringUtils::to_snakecase(*this); } -ByteString ByteString::to_titlecase() const -{ - return StringUtils::to_titlecase(*this); -} - -ByteString ByteString::invert_case() const -{ - return StringUtils::invert_case(*this); -} - bool ByteString::operator==(char const* cstring) const { if (!cstring) diff --git a/AK/ByteString.h b/AK/ByteString.h index e179dca909c..d8850c1303f 100644 --- a/AK/ByteString.h +++ b/AK/ByteString.h @@ -136,8 +136,6 @@ public: [[nodiscard]] ByteString to_lowercase() const; [[nodiscard]] ByteString to_uppercase() const; [[nodiscard]] ByteString to_snakecase() const; - [[nodiscard]] ByteString to_titlecase() const; - [[nodiscard]] ByteString invert_case() const; [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index 148531bdcfa..c10f969d133 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -504,20 +504,6 @@ ByteString to_titlecase(StringView str) return builder.to_byte_string(); } -ByteString invert_case(StringView str) -{ - StringBuilder builder(str.length()); - - for (auto ch : str) { - if (is_ascii_lower_alpha(ch)) - builder.append(to_ascii_uppercase(ch)); - else - builder.append(to_ascii_lowercase(ch)); - } - - return builder.to_byte_string(); -} - // Finishes the replacing algorithm once it is known that ita least one // replacemnet is going to be done. Otherwise the caller may want to follow a // different route to construct its output. diff --git a/AK/StringUtils.h b/AK/StringUtils.h index 8826e321b8b..0e0a2ef54f5 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -106,7 +106,6 @@ Optional find_any_of(StringView haystack, StringView needles, SearchDire ByteString to_snakecase(StringView); ByteString to_titlecase(StringView); -ByteString invert_case(StringView); ByteString replace(StringView, StringView needle, StringView replacement, ReplaceMode); ErrorOr replace(String const&, StringView needle, StringView replacement, ReplaceMode);