Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | exe2k |
When I use EN language in my string value
var test = "GIRL"
print(test.to_lower())
the result: girl
BUT since I change value of var to russian
var test = "ДЕВОЧКА"
I end up with ДЕВОЧКА, just like if the fn to_lower
isn’t working at all
Help me to fix it plz
Looks like it is a bug, because even in beta 11 it is still occurs but works a little better than in “stable” (sometimes i got Latin chars in a string).
as a temporary solution I made this fn:
func to_lower(string):
var caps = ["А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж", "З", "И", "Й",
"К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш",
"Щ", "Ъ", "Ы", "Ь", "Э", "Ю", "Я"]
var small = ["а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", "й",
"к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш",
"щ", "ъ", "ы", "ь", "э", "ю", "я"]
for i in caps.size():
string = string.replacen (caps[i],small[i])
return string
may be it helps some one.
ps: I’m new to Godot, so if you know how to make this script be available for any project (at least locally) I would appreciate this so much. For example I have a script “lower.gd” containing this fn and I want reach this script from different projects.
exe2k | 2019-03-07 11:07