String: Add contains().
This commit is contained in:
parent
bf12719cca
commit
adbe948bda
57 changed files with 142 additions and 119 deletions
|
|
@ -833,7 +833,7 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
|
|||
|
||||
const String &new_name = p_text;
|
||||
|
||||
ERR_FAIL_COND(new_name.is_empty() || new_name.find(".") != -1 || new_name.find("/") != -1);
|
||||
ERR_FAIL_COND(new_name.is_empty() || new_name.contains(".") || new_name.contains("/"));
|
||||
|
||||
if (new_name == prev_name) {
|
||||
return; //nothing to do
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ void AnimationPlayerEditor::_animation_name_edited() {
|
|||
player->stop();
|
||||
|
||||
String new_name = name->get_text();
|
||||
if (new_name.is_empty() || new_name.find(":") != -1 || new_name.find("/") != -1) {
|
||||
if (new_name.is_empty() || new_name.contains(":") || new_name.contains("/")) {
|
||||
error_dialog->set_text(TTR("Invalid animation name!"));
|
||||
error_dialog->popup_centered();
|
||||
return;
|
||||
|
|
@ -746,7 +746,7 @@ void AnimationPlayerEditor::_load_animations(Vector<String> p_files) {
|
|||
file = file.substr(file.rfind("\\") + 1, file.length());
|
||||
}
|
||||
|
||||
if (file.find(".") != -1) {
|
||||
if (file.contains(".")) {
|
||||
file = file.substr(0, file.find("."));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,7 @@ void AnimationNodeStateMachineEditor::_removed_from_graph() {
|
|||
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
|
||||
const String &new_name = p_text;
|
||||
|
||||
ERR_FAIL_COND(new_name.is_empty() || new_name.find(".") != -1 || new_name.find("/") != -1);
|
||||
ERR_FAIL_COND(new_name.is_empty() || new_name.contains(".") || new_name.contains("/"));
|
||||
|
||||
if (new_name == prev_name) {
|
||||
return; // Nothing to do.
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void ResourcePreloaderEditor::_item_edited() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (new_name.is_empty() || new_name.find("\\") != -1 || new_name.find("/") != -1 || preloader->has_resource(new_name)) {
|
||||
if (new_name.is_empty() || new_name.contains("\\") || new_name.contains("/") || preloader->has_resource(new_name)) {
|
||||
s->set_text(0, old_name);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ void EditorStandardSyntaxHighlighter::_update_cache() {
|
|||
if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
|
||||
continue;
|
||||
}
|
||||
if (name.find("/") != -1) {
|
||||
if (name.contains("/")) {
|
||||
continue;
|
||||
}
|
||||
highlighter->add_member_keyword_color(name, member_variable_color);
|
||||
|
|
@ -714,7 +714,7 @@ void ScriptEditor::_open_recent_script(int p_idx) {
|
|||
return;
|
||||
}
|
||||
// if it's a path then it's most likely a deleted file not help
|
||||
} else if (path.find("::") != -1) {
|
||||
} else if (path.contains("::")) {
|
||||
// built-in script
|
||||
String res_path = path.get_slice("::", 0);
|
||||
if (ResourceLoader::get_resource_type(res_path) == "PackedScene") {
|
||||
|
|
@ -2292,7 +2292,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
|
|||
|
||||
} else if (flags[i] == '\0' || (!inside_quotes && flags[i] == ' ')) {
|
||||
String arg = flags.substr(from, num_chars);
|
||||
if (arg.find("{file}") != -1) {
|
||||
if (arg.contains("{file}")) {
|
||||
has_file_flag = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1295,7 +1295,7 @@ void ScriptTextEditor::_edit_option_toggle_inline_comment() {
|
|||
script->get_language()->get_comment_delimiters(&comment_delimiters);
|
||||
|
||||
for (const String &script_delimiter : comment_delimiters) {
|
||||
if (script_delimiter.find(" ") == -1) {
|
||||
if (!script_delimiter.contains(" ")) {
|
||||
delimiter = script_delimiter;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue