1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

Add String::replace_char(s) methods for performance and convenience

This commit is contained in:
A Thousand Ships
2024-05-28 12:15:00 +02:00
parent c374ce211c
commit 889410dcda
67 changed files with 297 additions and 137 deletions

View File

@@ -103,7 +103,8 @@ const Vector<String> classes_with_csharp_differences = {
};
#endif
static const String nbsp = String::chr(160);
static const char32_t nbsp_chr = 160;
static const String nbsp = String::chr(nbsp_chr);
static const String nbsp_equal_nbsp = nbsp + "=" + nbsp;
static const String colon_nbsp = ":" + nbsp;
@@ -121,7 +122,7 @@ const Vector<String> packed_array_types = {
};
static String _replace_nbsp_with_space(const String &p_string) {
return p_string.replace(nbsp, " ");
return p_string.replace_char(nbsp_chr, ' ');
}
static String _fix_constant(const String &p_constant) {