本代码处理的字符串不得有空格和特殊符号,也就是只能是大小写字母。- @echo off&setlocal enabledelayedexpansion
- set str=qdjSSM
- for /l %%i in (0 1 100) do (
- if "!str:~%%i,1!" neq "" (
- set "s=!s!!str:~%%i,1! "
- )
- )
- set "ll=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
- set "ss=a b c d e f g h i j k l m n o p q r s t u v w x y z"
- for %%a in (%s%) do (
- for %%b in (%ll%) do (
- if /i %%a equ %%b (
- if %%a neq %%b (
- set res=!res!%%b
- )
- )
- )
- for %%b in (%ss%) do (
- if /i %%a equ %%b (
- if %%a neq %%b (
- set res=!res!%%b
- )
- )
- )
- )
- echo %res%
- pause
复制代码
|