🐐 SCINDE
This commit is contained in:
@@ -1328,6 +1328,18 @@ class BuiltIn(Node):
|
||||
except re.error as e:
|
||||
raise CentvrionError(f"Invalid regex: {e}")
|
||||
return vtable, ValStr(result)
|
||||
case "SCINDE":
|
||||
string = params[0]
|
||||
delimiter = params[1]
|
||||
if not isinstance(string, ValStr) or not isinstance(delimiter, ValStr):
|
||||
raise CentvrionError("SCINDE requires two strings")
|
||||
s = string.value()
|
||||
d = delimiter.value()
|
||||
if d == "":
|
||||
parts = [ValStr(c) for c in s]
|
||||
else:
|
||||
parts = [ValStr(p) for p in s.split(d)]
|
||||
return vtable, ValList(parts)
|
||||
case "PETE":
|
||||
if "RETE" not in vtable["#modules"]:
|
||||
raise CentvrionError("Cannot use 'PETE' without module 'RETE'")
|
||||
|
||||
Reference in New Issue
Block a user