[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

回复 1楼 的帖子

@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!

[ 本帖最后由 myzwd 于 2009-2-26 13:52 编辑 ]
1

评分人数

TOP

回复 1楼 的帖子-

@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!

如果有一个字母大小写都含有时,没法转换,这改怎么办?

TOP

回复 5楼 的帖子

  1. 要是改为
  2. pause
  3. mode con cp select=936
  4. cls
  5. exit /b
  6. 就完美了
复制代码

[ 本帖最后由 myzwd 于 2009-2-27 23:05 编辑 ]

TOP

返回列表