Below is a program for converting strings in table order. The original text comes from the development room of this site:
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9250
This program is written for the sequential conversion of string values in batch processing. It is generally called as a subroutine by other programs. It can also be slightly modified and added as a sub-module call in a specific batch processing program.
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9250
This program is written for the sequential conversion of string values in batch processing. It is generally called as a subroutine by other programs. It can also be slightly modified and added as a sub-module call in a specific batch processing program.
@echo off
if == goto %2
if == goto nullargu
:main Main module: The parameter lists of count and match can be reset and increased or decreased as needed
set factor=%1
call %0 $ count 1 2 3 4 5 7 8 9
call %0 $ match c d e f g h i j
goto display
:count Counting module: Set variable values #a1, #a2 according to the specified parameter factor
if == goto overflow
set #a1=%#a1%-
if not == goto count_2
set #a1=
set #a2=%#a2%+
if == goto overflow
:count_2
if == goto end
shift
goto count
:match Matching module: Loop to increment variables #b1, #b2. If they are equal to #a1, #a2 respectively, then specify the result value as the current loop parameter 3.
if == goto overflow
set #b1=%#b1%-
if not == goto match_2
set #b1=
set #b2=%#b2%+
if == goto overflow
:match_2
if == if == set result=%3
if not == goto end
shift
goto match
:display Display module: Display the assignment result
if == echo %factor% convert %result%
set result=
set factor=
set error=
set #a1=
set #a2=
set #b1=
set #b2=
goto end
:nullargu
echo.
echo Error: argument 1 not specified.
echo.
goto end
verflow
echo.
echo Error: number is overflow.
set error=overflow
echo.
goto end
:end
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!

DigestI
verflow
