Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dap404 |
What it does is not allow anything but letters and numbers and the word must be 3-11 in length, which works fine.
Every time you type a letter, the edit text change is called and we do a check to make sure it doesnt contain an illegal word.
Tested a bunch in godot and works great with the runner but on iphone it seems to not work.
var prohibited_name_list = [
"butt", "ace", "test", "bad", "word"
]
func _on_name_edit_text_changed(new_text):
confirm_button.disabled = true
var word = ""
regex.compile("[a-zA-Z0-9]+")
for curr in regex.search_all(new_text):
word += curr.get_string()
entered_name.set_text(word)
entered_name.caret_column = word.length()
confirm_botton_check(entered_name.text)
func confirm_botton_check(word:String):
if word.length() > 3 and word.length() < 12:
var is_bad = false
print(word)
for bad_word in prohibited_name_list:
if word.contains(bad_word):
is_bad = true
break
if !is_bad:
confirm_button.disabled = false
note
So on ios if i type butt123 it does not throw an error
BUT if i add a character(s) before it like xbutt123 it catches it on ios fine.
Super confused.