中国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 07:02
47,820 topics / 349,938 posts / today 0 new / 48,298 members
DOS批处理 & 脚本技术(批处理室) » A character sorting problem for newbies (bonus question)
Printable Version  3,194 / 21
Floor16 bat-zw Posted 2008-05-21 17:09
金牌会员 Posts 1,276 Credits 3,105
Brothers might as well write it out and have a look.
Floor17 pusofalse Posted 2008-05-21 17:38
银牌会员 Posts 646 Credits 1,604


It's very cumbersome, and can only be done to this extent. Completely copied~ - -||
Floor18 qdloverr Posted 2008-05-21 18:25
初级用户 Posts 33 Credits 97
for /f "tokens=1-14" %%a in ("13 z 113 -3 778 10004 f k a 119 -101 8 -19 m") do echo %%k %%m %%d %%l %%a %%c %%j %%e %%f %%i %%g %%h %%n %%b
pause

pause
The most stupid, simplest method
Just format it...
Haha, don't scold me

[ Last edited by qdloverr on 2008-5-21 at 06:27 PM ]
Floor19 bat-zw Posted 2008-05-21 18:25
金牌会员 Posts 1,276 Credits 3,105
Floor20 pusofalse Posted 2008-05-21 18:30
银牌会员 Posts 646 Credits 1,604
Originally posted by zw19750516 at 2008-5-21 06:25 PM:
Add points to encourage.

Senior, you added points by mistake! I already said it's plagiarized~ There was such a previous post about sorting, it seems it was from senior terse~
Floor21 netbenton Posted 2009-01-01 06:51
银牌会员 Posts 752 Credits 1,916 From 广西
@echo off&setlocal enabledelayedexpansion

set str= 13 z 113 -3 778 10004 f k a 119 -101 8 -19 m

for %%a in (%str%) do (
if %%a lss 999999 set cc=/%%a
if %%a lss 99999 set cc=//%%a
if %%a lss 9999 set cc=//%%a
if %%a lss 999 set cc=///%%a
if %%a lss 99 set cc=////%%a
if %%a lss 9 set cc=/////%%a
if %%a lss 1 set cc=/%%a
if not %%a lss 999999 set cc=/%%a
set bb!cc!=1
)

FOR /f "tokens=1 delims= " %%i IN ('SET bb ^| SORT /r') DO (
SET abc=%%i
SET abc=!abc:*/=!
SET abc=!abc:/=!
SET abc=!abc:~0,-2!
set ok=!abc! !ok!
)
echo. & echo Original array: !str! & echo Sorted output: !ok!

pause
Floor22 netbenton Posted 2009-01-02 00:07
银牌会员 Posts 752 Credits 1,916 From 广西
```batch
@echo off&setlocal enabledelayedexpansion

set str= 13 z 113 -3 778 10004 f k a 119 -101 8 -19 m

for %%a in (!str!) do (

if %%a geq a (set cc=/%%a) else set cc=///////////%%a
set cc=!cc:~-10!
set bb!cc!=1
)

FOR /f "tokens=1 delims= " %%i IN ('SET bb') DO (
SET abc=%%i
SET abc=!abc:*/=!
SET abc=!abc:/=!
SET abc=!abc:~0,-2!
set ok=!ok! !abc!
)
echo. & echo Original array: !str! & echo Sorted output: !ok!

pause
```
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023