I think there should be a condition to check if a string is alphanumeric. (Containing only letters and numbers)
chat:
message is alphanumeric:
send "Message is alphanumeric"
You can use regex for now, I guess...
Yeah I do, but it would be better to have a condition for it.
Skript-mirror ¯_(ツ)_/¯
I'm on Minehut :P
Well, then use regex. I don't know why I even commented in here.
TuSKe has some RegEx expressions you can use.
If this is going to be implemented, please also add RegEx support to Skript :)
This is what I have in MirrorUtils:
#
# STRING IS OF CHARACTER TYPE
# Checks if a string only has one type of characters.
#
# Usage:
# + "abc123" is alphabetic
# Result: [condition] does not pass
#
condition %string% is (1¦(unicode|alpha)|2¦alphanumeric|3¦alphabetic|4¦all lowercase|5¦all uppercase):
check:
if parse mark = 1:
set {_boolean} to StringUtils.isAlpha(expr-1)
else if parse mark = 2:
set {_boolean} to StringUtils.isAlphanumeric(expr-1)
else if parse mark = 3:
set {_boolean} to StringUtils.isAlphabetic(expr-1)
else if parse mark = 4:
set {_boolean} to StringUtils.isAllLowerCase(expr-1)
else:
set {_boolean} to StringUtils.isAllUpperCase(expr-1)
continue if {_boolean} = true
Regex is something that I wouldn't want in Skript for a variety of reasons, it's better for it to be in an addon rather than Skript itself.
We could implement this condition though.
@FranKusmiruk some example reasons?
@bensku please close this enhancement, was added in beta6 :)
Most helpful comment
Skript-mirror ¯_(ツ)_/¯