
CODE: [Copy to clipboard]@echo off
call:ReversOut "12345&6" strs
::这种方法兼容特殊字符
set/p "tt=%strs%"<nul
echo\&pause
exit
:: /*-------ReversOut--------------
:ReversOut ["string"] [string]
setlocal ENABLEEXTENSIONS
set "str=%~1"
:ReversOut_1
set "strs=%str:~0,1%%strs%"
set "str=%str:~1%"
if defined str goto:ReversOut_1
endlocal&set "%2=%strs%"&goto:eof
:: ---------ReversOut------------*/
| Quote: | |
|
CODE: [Copy to clipboard]@echo off
call:ReversOut "1234&56" strs
::这种方法兼容特殊字符,但会过滤引号。
set/p "tt=%strs%"<nul
echo\&pause
::子过程用for会对!过来,用goto+call,set可以不过滤但速度慢了。
:: /*-------ReversOut--------------
:ReversOut ["string"] [string]
setlocal enabledelayedexpansion
set "str=%~1"&set "s="
for /l %%a in (200 -1 0)do if not "!str:~%%a,1!"=="" set s=!s!!str:~%%a,1!
endlocal&set "%2=%s%"&goto:eof
:: ---------ReversOut------------*/
CODE: [Copy to clipboard]关键字:反序 倒着 输出字符 函数@echo off
call:ReversOut "12345&6" strs
::这种方法兼容特殊字符,但会过滤引号。
set/p "tt=%strs%"<nul
:: /*-------ReversOut--------------
:ReversOu ["string"] [string]
setlocal ENABLEEXTENSIONS
set "str=%~1"
:ReversOut_1
set "strs=%str:~0,1%%strs%"
set "str=%str:~1%"
if defined str goto:ReversOut_1
endlocal&set "%2=%strs%"&goto:eof
:: ---------ReversOut------------*/
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |