@echo off
echo. 大小写字母转换--Uppercase-reChange-Lowercase-----------
set small=a b c d e f g h i j k l m o p q r s t u v w x y z
set big=A B C D E F G H I J K L M N O P Q R S T U V W S Y Z
set tt=abHJ dfsKHK aB
rem 以上是原始字符可以改为命令输入set /p tt=
echo 转换前的字符:%tt%
setlocal enabledelayedexpansion
ne
set tt1=!tt:~-1!
set tt2=!tt:~0,-1!
set tt=!tt1!+!tt2!
if !tt:~-1! neq + (goto:one) else (set tt=!tt:+=,!&echo 插入逗号后:!tt!)
:a
for %%i in (!small!) do (
for %%j in (!tt!) do (
if %%i==%%j (set sml=!sml!%%j )
)
)
:b
for %%i in (!big!) do (
for %%j in (!tt!) do (
if %%i==%%j (set bg=!bg!%%j )
)
)
:end
echo 原始字符里面的小写字母:!sml!
echo 原始字符里面的大写字母:!bg!
for %%1 in (!big!) do (
for %%2 in (!sml!) do (
if /i %%1==%%2 (set tt=!tt:%%2=%%1! )
)
)
echo 把原始字符里的小写转换成大写:!tt!
for %%1 in (!small!) do (
for %%2 in (!bg!) do (
if /i %%1==%%2 (set tt=!tt:%%2=%%1! &echo !tt!)
)
)
set tt=!tt:,=!
echo 转换后的字符:!tt!-成功.ok!
@echo off
cls
echo -----大小写转换--不能输入同时含有象m和M这类字符--
set small=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 big=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 /p char=
setlocal enabledelayedexpansion
:start
set charend=!char:~-1!
set chardel=!char:~,-1!
set char=!charend!+!chardel!
if !char:~-1! neq + (goto start) else (set char=!char:+=!)
echo 字符状态: !char!
:sml
for %%i in (!small!) do (
for %%j in (!char!) do (
if %%i == %%j (set sml=!sml! %%j)
)
)
echo sml集合: !sml!
:bg
for %%i in (!big!) do (
for %%j in (!char!) do (
if %%i == %%j (set bg=!bg!%%j )
)
)
echo bg集合: !bg!
:small
set charend=!char:~,1!
for %%i in (!sml!) do (
if !charend! == %%i (
for %%j in (!big!) do (
if /i %%j == !charend! (set charend=%%j)
)
)
)
:big
for %%i in (!bg!) do (
if !charend! == %%i (
for %%j in (!small!) do (
if /i %%j == !charend! (set charend=%%j)
)
)
)
set chardel=!char:~1!
set char=!chardel!+!charend!
if !charend! neq + (goto small)
set char=!char:+=!
echo 新字符状态:!char!