如果排除查找相同数的最大行数,第二种应该说最快了。 | @echo off&setlocal enabledelayedexpansion | | for /f "delims=" %%i in (a.txt) do ( | | for /f "delims=:" %%a in ('(echo,%%i^&echo,^)^|findstr /o "."') do set/a len=%%a-3 | | if not defined max set max=!len! | | if !len! geq !max! set max=!len!&set "#=%%i" | | ) | | echo,%#% | | pauseCOPY |
| @echo off&setlocal enabledelayedexpansion | | for /f "delims=" %%i in (堕落血天使.txt) do ( | | set/a len=0&set "str=%%i$" | | for %%a in (4096,2048,1024,516,258,126,64,32,16,8,4,2,1) do ( | | if not "!str:~%%a!"=="" set/a len+=%%a&set str=!str:~%%a! | | ) | | if not defined max set max=!len! | | if !len! geq !max! set max=!len!&set "#=%%i" | | ) | | echo,%#% | | pauseCOPY |
|