回复 5# netdzb - @echo off & setlocal enabledelayedexpansion
-
- :main
- set "str=utnubn xunil nohtyp"
- echo 原来的字符串是 %str%
- call:deal str
- echo 倒叙字符串是 %str%
- pause
- goto:eof
-
- :deal
- set "str_cpy=!%~1!"
- set "str_don="
- call:len str_cpy
- for /L %%i in (0,1,%len%) do (
- set "str_don=!str_cpy:~0,1!!str_don!"
- set "str_cpy=!str_cpy:~1!"
- )
- set "%~1=%str_don%"
- goto:eof
-
- :len
- set len_cpy=!%~1!
- set len=0
- for %%i in (128,64,32,16,8,4,2,1) do if not "!len_cpy:~%%i,1!"=="" (
- set /A len+=%%i
- set len_cpy=!len_cpy:~%%i!
- )
- goto:eof
复制代码
|