中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-24 09:33
47,820 topics / 349,938 posts / today 0 new / 48,298 members
DOS批处理 & 脚本技术(批处理室) » How to extract the numbers from the combination of <letters + numbers>
Printable Version  4,654 / 18
Floor16 mouzeming Posted 2006-12-28 22:08
初级用户 Posts 28 Credits 66
The problem comes again. I'm sorry,

The number is put forward. For example, the user inputs a001 & a100.

If it's a number like a001, I need to remove the preceding a00.

If it's a number like a100, I just need to remove a100. The above code can achieve this.

That is to say, there needs to be a judgment on the value input by the user. If the number after the letter is 0, don't take it. Take the number after 0. Like what I said above, for a001, I only take 1. But for other input a100, I need to take 100. This feels relatively difficult.
Floor17 vkill Posted 2006-12-29 02:31
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
Originally posted by jmz573515 at 2006-12-28 21:59:
Is there an idea, I wonder if this method can be used when entering the password?

Yes, it can
Floor18 zh159 Posted 2006-12-31 00:03
金牌会员 Posts 1,467 Credits 3,687
Originally posted by mouzeming at 2006-12-28 09:08:
Here comes the problem again. Sorry,
The number is put forward. For example, the user enters a001 & a100
If it is a number like a001, I need to remove the a00 in front..
If it is a number like a100, I only ...

Floor19 minmin888 Posted 2007-05-08 19:55
初级用户 Posts 62 Credits 127
@echo off
setlocal enabledelayedexpansion

set/p aa=Enter your text:

if not defined aa goto :eof
set number=

:loop
if not defined aa goto :e
echo %aa:~0,1%|findstr "[0-9]">nul&&set number=!number!%aa:~0,1%
set aa=%aa:~1%
goto loop
:e
echo !number!
pause
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023