返回列表 发帖
感谢rat提出纠正哈!!

TOP

回复 14楼 的帖子

右上角有个按钮“新帖”
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 1楼 的帖子

@echo off
set /p str=
echo. %str%
echo *****************************
if %str:~0,1% neq 0 (echo This is not a numeral ---NaN  & echo bye & goto:eof)
echo orginal str---%str%
:one
if %str:~0,1% equ 0 (set str=%str:~1% )
if %str:~0,1% equ 0 goto one
:end
echo string after delete zero---- %str%COPY

[ 本帖最后由 myzwd 于 2009-2-28 17:31 编辑 ]

TOP

我来凑一个
@echo off
set /p num=please input number:
:start
set var=%num:~0,1%
if %var% equ 0 (set num=%num:~1% & goto start) else (echo %num% & pause) COPY
(*^_^*)

TOP

@echo off
set /p str=请输入字符:
:begin
set a=%str:~0,1%
if  not %a%==0 (goto eof) else ( set %a%==""&&set str=%str:~1%&&goto begin )
:eof
echo %str%
pauseCOPY

[ 本帖最后由 cainiao736 于 2009-3-26 22:33 编辑 ]

TOP

@echo off
:input
cls
set /p str=请输入一串字符(纯数字):
echo.%str%|findstr "^[0-9]*$">nul|| (cls& echo 所输入的不是纯数字,请重新输入& pause& goto input)
for /f "delims=0 tokens=1*" %%i in ("10%str%") do set str2=%%j
cls
echo 你输入的字符串为:%str%
echo 去前面所有的零为:%str2%
pause
goto inputCOPY

TOP

我菜鸟而且,来瞧瞧

TOP

@echo off
setlocal EnableDelayedExpansion
set /p d=用户输入一串字符:
for %%i in (%d%) do (
set a=%%i
set b=!a:~1,5!
set c=!b:~-4!
echo !c!
)
pause
set a=
set b=
set c=
set d=COPY

TOP

哈哈 各有千秋呀

TOP

@echo off
set /p n=请输入字符串:
echo %n%|findstr "^[0-9][0-9]*$">nul
if errorlevel 1 echo 不是纯数字&pause&goto :eof else (
:loop
if "%n:~0,1%"=="0" (
set n=%n:~1%
echo %n%
goto loop
) else goto ex    ::一旦出现第一个不是0的字符则跳出
)
:ex
echo %n%
pauseCOPY

TOP

本帖最后由 battab 于 2014-2-18 22:51 编辑

回复 1# yslyxqysl
@echo off
:r
set "input="
set /p input=请输入要入理的数字串:
echo %input%|findstr "^[0-9][0-9]*$">nul||(echo 包含非数字)&&goto r
set str=%input%
:l
if "%str:~0,1%"=="0" (set str=%str:~1%) else (goto end)
goto l
:end
echo %str%
pause>nul
echo 继续请按r,退出请按任意键。
set "enter="
set /p enter=请输入:
if "%enter%"=="r" goto r else exitCOPY
学习中

TOP

@echo off
echo 请输入内容
set /p a=

:a
if %a:~0,1% neq 0 goto :b
set a=%a:~1%
goto :a

:b
echo %a%
pause

TOP

本帖最后由 shelluserwlb 于 2014-11-9 17:24 编辑
@echo off
setlocal enabledelayedexpansion
:again
set /p n=请输入一段字符(纯数字):
echo %n%|findstr "^[0-9][0-9]*$">nul||goto again
for /l %%i in (0,1,1000) do (
    echo !n:~%%i,1!|findstr "0" >nul||(echo !n:~%%i! & goto :end)
)
:end
pauseCOPY

TOP

rat 发表于 2009-1-15 22:54



   
批处理文件当js文件用,学习了……

TOP

也发一个吧,没考虑太多
@echo off&setlocal enabledelayedexpansion
set /p sr=请输入数字:
for /l %%a in (0 1 1000) do (set sw=!sr:~%%a,1!&if not "!sw!"=="0" (call :qc %%a))
:qc
set aa=%1
goto ii
:ii
set sc=!sr:~%aa%!
echo %sc%
goto end
:end
pause>nul&exitCOPY

TOP

返回列表