Syntax
cargs(string)
Description
The cargs() function returns an array of arguments from a given string that can be handled in a similar way as the results of the args() function.
Example
newArgs=cargs("-f /bin/ls -title "This is a string" -foo -b 9") println(newArgs) ["-f", "/bin/ls", "-title", "\"This is a string\"", "-foo", "-b", "9"]
This may come in handy for passing multiple arguments to functions.
function foo(FArgs) { a=10 b=5 Args=cargs(FArgs) if (Args[0] == "-b") { b=int(Args[1]) } return a + b } z=foo("-b 6") println(z) z=foo("") println(z) 16 15