中国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-09-23 22:53
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » [Discussion] ********Question about the Usage of findstr/a********
Printable Version  5,351 / 23
Floor16 vkill Posted 2007-11-27 21:05
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
What is the code for 0401 optimized?
Floor17 s11ss Posted 2007-11-27 21:25
银牌会员 Posts 566 Credits 2,098
There are restrictions. It can only convert up to 10 hexadecimal digits (excluding the first two 0s), but it seems to be sufficient.
Floor18 zh159 Posted 2007-11-27 23:53
金牌会员 Posts 1,467 Credits 3,687
Originally posted by s11ss at 2007-11-27 20:51:
Brother zh159, your code for converting multiple digits is no less wordy than mine~~~~~~~~
I'm sorry, I take that back.
Actually, each has its own advantages and disadvantages.
Yours is simple but reduces code readability and increases "program processing volume" (replaces 0-9 all). Mine is wordy but improves code readability.

In terms of "program processing volume", your processing volume should be larger:
call set r=%%r:10=A%%
call set r=%%r:11=B%%
call set r=%%r:12=C%%
call set r=%%r:13=D%%
call set r=%%r:14=E%%
call set r=%%r:15=F%%
call set r%1=%r%%%r%1%%

This part is also a replacement process. Each conversion has to go through six replacements. Data from 0-9 is also processed the same way. It's just that there are no "10-15" numbers in 0-9, so A-F won't be replaced out;
The simplified one I have (the original source should be the version of the moderator Budu Bu Ai) although it reduces code readability, but only needs one-time replacement (actually character interception), which is more efficient

In fact, you can find the same place by just comparing

:10to16
set/a q=%1
:1c
set/a r=%q%%%16
set/a q=%q%/16
call set r=%%r:10=A%%
call set r=%%r:11=B%%
call set r=%%r:12=C%%
call set r=%%r:13=D%%
call set r=%%r:14=E%%
call set r=%%r:15=F%%

call set r%1=%r%%%r%1%%
if not %q% equ 0 goto :1c
call set r=%%r%1%%


:10to16
set H=0123456789ABCDEF
set/a q=%1
:1c
set/a r=%q%%%16
set/a q=%q%/16
call set r=%%H:~%r%,1%%
call set r%1=%r%%%r%1%%
if not %q% equ 0 goto :1c
call set r=%%r%1%%
Floor19 fastslz Posted 2007-11-28 00:32
铂金会员 Posts 2,315 Credits 5,493 From 上海
iexplore about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>Unable to play Midi, possibly missing VB6 control
Download details: Microsoft Visual Basic 6.0 Common Controls
http://www.microsoft.com/downloads/details.aspx?familyid=25437D98-51D0-41C1-BB14-64662F5F62FE&displaylang=zh-cn
Floor20 s11ss Posted 2007-11-28 13:03
银牌会员 Posts 566 Credits 2,098
Brother zh159 makes a valid point. I said something wrong again. Indeed, my code is a bit worse. I'll correct it!
Floor21 electronixtar Posted 2007-12-02 17:31
铂金会员 Posts 2,672 Credits 7,493
Originally posted by fastslz at 2007-11-28 00:32:
iexplore about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>Cannot play Midi, may be missing VB6 control bar
Download details: Microsoft Visual Bas ...

Not VB library

It is VBA (Visual Basic for Applications) built into Office

vbe6.dll is a dll of the VB editor.

Actually, the easter egg in my signature is also in VB6, the same.
Floor22 knoppix7 Posted 2007-12-02 17:57
银牌会员 Posts 634 Credits 1,287 From cmd.exe
Hey, is it off-topic?
Floor23 wjmm Posted 2008-06-27 10:45
初级用户 Posts 19 Credits 48
Floor24 87zrjojo Posted 2026-06-26 16:24
新手上路 Posts 4 Credits 11
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023