Browse Source

Merge pull request #601 from colugomusic/fix-string-args-constness

Rémi Verschelde 3 years ago
parent
commit
7a693df988
2 changed files with 4 additions and 4 deletions
  1. 2 2
      include/core/String.hpp
  2. 2 2
      src/core/String.cpp

+ 2 - 2
include/core/String.hpp

@@ -105,14 +105,14 @@ public:
 	CharString utf8() const;
 	CharString ascii(bool p_extended = false) const;
 
-	bool begins_with(String &s) const;
+	bool begins_with(const String &s) const;
 	bool begins_with_char_array(const char *p_char_array) const;
 	PoolStringArray bigrams() const;
 	String c_escape() const;
 	String c_unescape() const;
 	String capitalize() const;
 	bool empty() const;
-	bool ends_with(String &text) const;
+	bool ends_with(const String &text) const;
 	void erase(int position, int chars);
 	int find(String what, int from = 0) const;
 	int find_last(String what) const;

+ 2 - 2
src/core/String.cpp

@@ -222,7 +222,7 @@ String operator+(const wchar_t *a, const String &b) {
 	return String(a) + b;
 }
 
-bool String::begins_with(String &p_string) const {
+bool String::begins_with(const String &p_string) const {
 	return godot::api->godot_string_begins_with(&_godot_string, &p_string._godot_string);
 }
 
@@ -251,7 +251,7 @@ bool String::empty() const {
 	return godot::api->godot_string_empty(&_godot_string);
 }
 
-bool String::ends_with(String &p_string) const {
+bool String::ends_with(const String &p_string) const {
 	return godot::api->godot_string_ends_with(&_godot_string, &p_string._godot_string);
 }