Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
17
Task/Reverse-a-string/Batch-File/reverse-a-string-1.bat
Normal file
17
Task/Reverse-a-string/Batch-File/reverse-a-string-1.bat
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
call :reverse %1 res
|
||||
echo %res%
|
||||
goto :eof
|
||||
|
||||
:reverse
|
||||
set str=%~1
|
||||
set cnt=0
|
||||
:loop
|
||||
if "%str%" equ "" (
|
||||
goto :eof
|
||||
)
|
||||
set chr=!str:~0,1!
|
||||
set str=%str:~1%
|
||||
set %2=%chr%!%2!
|
||||
goto loop
|
||||
11
Task/Reverse-a-string/Batch-File/reverse-a-string-2.bat
Normal file
11
Task/Reverse-a-string/Batch-File/reverse-a-string-2.bat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@echo off
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
set str=%1
|
||||
::strlen4 from https://ss64.com/forum/strlen.html
|
||||
set "tempFile=%temp%\strlen-reverse.tmp"
|
||||
echo(%str%>"%tempFile%"
|
||||
for %%F in ("%tempFile%") do set /a len=%%~zF-3
|
||||
del "%tempFile%"
|
||||
<nul (
|
||||
for /l %%i in (%len%,-1,0) do set/p=!str:~%%i,1!
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue