stringStartsWith with ash shell

for busybox shell ash, string starts with function

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
stringstartswith(){
    local len=$(expr length $2)
    local input=$(expr substr $1 1 $len)
        if [ $input = $2 ];then
            echo true
        else
            echo false
        fi

}