More functions, plus a bugfix for mid
This commit is contained in:
@@ -71,7 +71,6 @@ fun -string !inBrackets -string &str -char &left -char &right -int &instance
|
|||||||
pusharg $left
|
pusharg $left
|
||||||
pusharg $instance
|
pusharg $instance
|
||||||
call !findCharInstance &store
|
call !findCharInstance &store
|
||||||
stdlnout $store
|
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
fun -bool !matchStart -string &str -string &instr
|
fun -bool !matchStart -string &str -string &instr
|
||||||
@@ -156,6 +155,8 @@ endfun
|
|||||||
fun -bool !contains -string &str -string &instr
|
fun -bool !contains -string &str -string &instr
|
||||||
getstrsize $str &len
|
getstrsize $str &len
|
||||||
getstrsize $instr &inlen
|
getstrsize $instr &inlen
|
||||||
|
greater $inlen $len &store
|
||||||
|
if $store %false
|
||||||
subtract $len $inlen &len
|
subtract $len $inlen &len
|
||||||
set &idx 0
|
set &idx 0
|
||||||
|
|
||||||
@@ -179,4 +180,44 @@ fun -bool !contains -string &str -string &instr
|
|||||||
|
|
||||||
@false
|
@false
|
||||||
return false
|
return false
|
||||||
|
endfun
|
||||||
|
|
||||||
|
fun -list !split -string &str -string &splitstr
|
||||||
|
setlist *list
|
||||||
|
getstrsize $splitstr &splitlen
|
||||||
|
@loop
|
||||||
|
pusharg $str
|
||||||
|
pusharg $splitstr
|
||||||
|
call !contains &store
|
||||||
|
if $store %continue
|
||||||
|
jump %end
|
||||||
|
|
||||||
|
@continue
|
||||||
|
# Find text before split char
|
||||||
|
pusharg $str
|
||||||
|
pusharg $splitstr
|
||||||
|
pusharg 0
|
||||||
|
call !findStringInstance &store
|
||||||
|
|
||||||
|
# Store amount of characters to remove
|
||||||
|
add $store $splitlen &store2
|
||||||
|
|
||||||
|
# Get split
|
||||||
|
pusharg $str
|
||||||
|
pusharg 0
|
||||||
|
pusharg $store
|
||||||
|
call !mid &store
|
||||||
|
|
||||||
|
listappend *list $store
|
||||||
|
|
||||||
|
# Remove first split
|
||||||
|
pusharg $str
|
||||||
|
pusharg $store2
|
||||||
|
call !removeLeft &str
|
||||||
|
|
||||||
|
jump %loop
|
||||||
|
|
||||||
|
@end
|
||||||
|
listappend *list $str
|
||||||
|
return *list
|
||||||
endfun
|
endfun
|
Reference in New Issue
Block a user