Skip to content

Commit 8dad1ba

Browse files
committedAug 26, 2024
Merge pull request #92933 from TokageItLab/match-concatenating
Match the coding style for concatenating String
2 parents a5e157d + 12571a1 commit 8dad1ba

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed
 

‎core/string/node_path.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ StringName NodePath::get_concatenated_names() const {
215215
String concatenated;
216216
const StringName *sn = data->path.ptr();
217217
for (int i = 0; i < pc; i++) {
218-
concatenated += i == 0 ? sn[i].operator String() : "/" + sn[i];
218+
if (i > 0) {
219+
concatenated += "/";
220+
}
221+
concatenated += sn[i].operator String();
219222
}
220223
data->concatenated_path = concatenated;
221224
}
@@ -230,7 +233,10 @@ StringName NodePath::get_concatenated_subnames() const {
230233
String concatenated;
231234
const StringName *ssn = data->subpath.ptr();
232235
for (int i = 0; i < spc; i++) {
233-
concatenated += i == 0 ? ssn[i].operator String() : ":" + ssn[i];
236+
if (i > 0) {
237+
concatenated += ":";
238+
}
239+
concatenated += ssn[i].operator String();
234240
}
235241
data->concatenated_subpath = concatenated;
236242
}

‎scene/resources/skeleton_profile.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ void SkeletonProfile::_validate_property(PropertyInfo &p_property) const {
132132
if (p_property.name == ("root_bone") || p_property.name == ("scale_base_bone")) {
133133
String hint = "";
134134
for (int i = 0; i < bones.size(); i++) {
135-
hint += i == 0 ? String(bones[i].bone_name) : "," + String(bones[i].bone_name);
135+
if (i > 0) {
136+
hint += ",";
137+
}
138+
hint += String(bones[i].bone_name);
136139
}
137140
p_property.hint_string = hint;
138141
}

0 commit comments

Comments
 (0)
Please sign in to comment.