Sadiq
0
Q:

reverse string shwll

var="12345"
copy=${var}

len=${#copy}
for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done

echo "var: $var, rev: $rev"
0
1. Create a temporary byte[]  of length equal 
   to the length of the input string.
2. Store the bytes (which we get by using 
   getBytes() method) in reverse order into 
   the temporary byte[] .
3. Create a new String abject using byte[] to
   store result.
0

New to Communities?

Join the community