27 Jan 11, 10:17AM
Anyone who read this post will realize why these latest scripts are so exciting for me.
So... Thanks to Drakas for the inspiration!
replacestr - replaces a given string in a given list with another string
swapstrpos - swaps the two positions of two given strings in a given list
So... Thanks to Drakas for the inspiration!
[SELECT ALL] Code:
alias replacestr [
delalias tmp_list5
loop rs (listlen $arg1) [
if (strcmp (at $arg1 $rs) $arg2) [add2list tmp_list5 $arg3] [add2list tmp_list5 (at $arg1 $rs)]
]
result $tmp_list5
] // replacestr [I do not like CubeScript] "not" "really"
alias swapstrpos [
delalias tmp_list6
alias strpos1 (findlist $arg1 $arg2)
alias strpos2 (findlist $arg1 $arg3)
loop sw (listlen $arg1) [
if (= $sw $strpos1) [add2list tmp_list6 $arg3] [
if (= $sw $strpos2) [add2list tmp_list6 $arg2] [
add2list tmp_list6 (at $arg1 $sw)]]
]
result $tmp_list6
] // swapstrpos [I do really like CubeScript] "do" "really"
swapstrpos - swaps the two positions of two given strings in a given list