bugfix, inBrackets actually works

This commit is contained in:
2025-09-11 20:37:45 +10:00
parent f54d41f5b6
commit e028cae397
2 changed files with 26 additions and 4 deletions

View File

@@ -47,6 +47,9 @@ fun -string !mid -string &str -int &idx -int &len
set &ans ""
lesser $idx 0 &store
if $store %end
greater $len 0 &store
if $store %loop
return ""
@loop
getstrsize $str &store
equal $store $idx &store
@@ -66,11 +69,26 @@ fun -string !mid -string &str -int &idx -int &len
endfun
fun -string !inBrackets -string &str -char &left -char &right -int &instance
# Get start idx
# Get left idx
pusharg $str
pusharg $left
pusharg $instance
call !findCharInstance &store
call !findCharInstance &left
# Get right idx
pusharg $str
pusharg $right
pusharg $instance
call !findCharInstance &right
# Get inner string
add $left 1 &left
subtract $right $left &store
pusharg $str
pusharg $left
pusharg $store
call !mid &store
return $store
endfun
fun -bool !matchStart -string &str -string &instr