Solved UTF-8 blocking

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

gangula

Member
Jul 28, 2021
16
0
1
22
Russia
  1. Script Version (do not put latest): 2.6.3
  2. Minecraft Version: 1.16.5
I searched all the documentation, but I never found how to block utf-8 characters in the command argument.
 
For check if argument has invalid symbols:
Code:
if arg-1 doesn't match "[^a-zA-Z0-9]*":
  broadcast "argument contains invalid symbols"

For remove that symbols:
Code:
set {_arg1} to join (regex split arg-1 at "[^a-zA-Z0-9]") with ""

If your's point to remove invalid symbols -
best way is using addon contains work with regular expressions, or Skript-reflect via:
Code:
#%text%.replaceAll(%text_to_find%,%text_to_replace%)
set {_arg1} to arg-1.replaceAll("[^a-zA-Z0-9]","")
 
For check if argument has invalid symbols:
Code:
if arg-1 doesn't match "[^a-zA-Z0-9]*":
  broadcast "argument contains invalid symbols"

For remove that symbols:
Code:
set {_arg1} to join (regex split arg-1 at "[^a-zA-Z0-9]") with ""

If your's point to remove invalid symbols -
best way is using addon contains work with regular expressions, or Skript-reflect via:
Code:
#%text%.replaceAll(%text_to_find%,%text_to_replace%)
set {_arg1} to arg-1.replaceAll("[^a-zA-Z0-9]","")
It's working, it's finally working! Thank you very much, I've been digging through the documentation for three days, but now I've finally been able to implement my idea
 
Status
Not open for further replies.