mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fix get_node() and $ autocompletion when using single quotes
This commit is contained in:
@@ -2476,6 +2476,11 @@ bool String::begins_with(const char *p_string) const {
|
||||
return *p_string == 0;
|
||||
}
|
||||
|
||||
bool String::is_enclosed_in(const String &p_string) const {
|
||||
|
||||
return begins_with(p_string) && ends_with(p_string);
|
||||
}
|
||||
|
||||
bool String::is_subsequence_of(const String &p_string) const {
|
||||
|
||||
return _base_is_subsequence_of(p_string, false);
|
||||
@@ -2486,6 +2491,11 @@ bool String::is_subsequence_ofi(const String &p_string) const {
|
||||
return _base_is_subsequence_of(p_string, true);
|
||||
}
|
||||
|
||||
bool String::is_quoted() const {
|
||||
|
||||
return is_enclosed_in("\"") || is_enclosed_in("'");
|
||||
}
|
||||
|
||||
bool String::_base_is_subsequence_of(const String &p_string, bool case_insensitive) const {
|
||||
|
||||
int len = length();
|
||||
@@ -3906,6 +3916,18 @@ String String::sprintf(const Array &values, bool *error) const {
|
||||
return formatted;
|
||||
}
|
||||
|
||||
String String::quote(String quotechar) const {
|
||||
return quotechar + *this + quotechar;
|
||||
}
|
||||
|
||||
String String::unquote() const {
|
||||
if (!is_quoted()) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
return substr(1, length() - 2);
|
||||
}
|
||||
|
||||
#include "translation.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user