#!/usr/bin/ngraph -i ERROR=0 show_result() { if [ "$2" = "$3" ] then echo "OK. ($1)" else echo "error. ($1) '$2' '$3'" ERROR=1 fi } new string string::@=" a b b b c d e f BCD" show_result "strip" "${string::strip}" "a b b b c d e f BCD" show_result "upcase" "${string::upcase}" " A B B B C D E F BCD" show_result "downcase" "${string::downcase}" " a b b b c d e f bcd" show_result "reverse" "${string::reverse}" "DCB f e d c b b b a " show_result "slice" "${string::slice:'6 9'}" "b b c" show_result "slice" "${string::slice:'21 4'}" "f BC" show_result "index" "${string::index:'D 25'}" "25" show_result "index" "${string::index:'a 1'}" "1" show_result "rindex" "${string::rindex:'a 1'}" "1" show_result "rindex" "${string::rindex:'b 20'}" "10" show_result "match" "${string::match:'f.B'}" "true" show_result "match" "${string::match:'a[^b]+c'}" "false" exit $ERROR