From 7672c4a32d1d4e50bb41704c23773fb565bb41c6 Mon Sep 17 00:00:00 2001 From: chemodansama Date: Wed, 2 Oct 2024 20:11:59 +1000 Subject: [PATCH] Make String::startsWith and String::lastIndexOf const. (#2646) Co-authored-by: Grigory Shabaganov --- spine-cpp/spine-cpp/include/spine/SpineString.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-cpp/spine-cpp/include/spine/SpineString.h b/spine-cpp/spine-cpp/include/spine/SpineString.h index a11a77f8c..9036f7f57 100644 --- a/spine-cpp/spine-cpp/include/spine/SpineString.h +++ b/spine-cpp/spine-cpp/include/spine/SpineString.h @@ -179,7 +179,7 @@ namespace spine { return *this; } - bool startsWith(const String &needle) { + bool startsWith(const String &needle) const { if (needle.length() > length()) return false; for (int i = 0; i < (int)needle.length(); i++) { if (buffer()[i] != needle.buffer()[i]) return false; @@ -187,7 +187,7 @@ namespace spine { return true; } - int lastIndexOf(const char c) { + int lastIndexOf(const char c) const { for (int i = (int)length() - 1; i >= 0; i--) { if (buffer()[i] == c) return i; }