频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

全角英文转为半角

来源: 作者: 出处:巧巧读书 2006-09-16 进入讨论组
<HTML>
<head>
<title>将全角转为半角,半角转为全角</title>
<meta http-equiv="Content-Type" content="text/HTML; charset=gb2312">
</head>

<body bgcolor="#FFFFFF">

<%
'---------------------------------------
'编写:johnsun Email:zjs@dagongbao.com
'语言:ASP+VBScript 转摘请保留版权说明
'direction:"1"大写转小写;"-1"小写转大写
'---------------------------------------

dim contentA,contentB
contentA=request.form("contentA")
if contentA<>"" then
    CALL contentstr(contentA,"1")
end if
contentB=request.form("contentB")
if contentB<>"" then
    CALL contentstr(contentB,"-1")
end if

function contentstr(content,direction)
    dim strbig,tstrbig,strsma,tstrsma
    strbig="ABCDEFGHIJKLMNOPQRSTUVWXYZ'"
    tstrbig="ABCDEFGHIJKLMNOPQRSTUVWXYZ'"
    strsma="abcdefghijklmnopqrstuvwxyz"
    tstrsma="abcdefghijklmnopqrstuvwxyz"
    dim b(26),tb(26),s(25),ts(25)
    for i=1 to 26
        b(i-1)=mid(strbig,i,1)
        tb(i-1)=mid(tstrbig,i,1)
    if direction="1" then
        content=replace(content,b(i-1),tb(i-1))
    elseif direction="-1" then
        content=replace(content,tb(i-1),b(i-1))
    end if
        s(i-1)=mid(strsma,i,1)
        ts(i-1)=mid(tstrsma,i,1)
    if direction="1" then
        content=replace(content,s(i-1),ts(i-1))
    elseif direction="-1" then
        content=replace(content,ts(i-1),s(i-1))
    end if
    next
'-------------------------------------------
content=replace(content,chr(13)&chr(10),"<br>")
    if direction="1" then
        content=replace(content," "," ")
    else
        content=replace(content," "," ")
    end if
'-------------------------------------------
    contentstr=content
    if direction="1" then
        response.write "大写转小写:<br>"
    else
        response.write "小写转大写:<br>"
    end if
    response.write contentstr & "<BR>"
end function
%>
<form action='d.ASP' method="post">
大写转小写:
  <textarea name="contentA" rows="8" cols="30">
A lady said to her friend that the sun is the most beautiful and useful body。
A gentlman answered:“Yes,Madam,the sun is a very fine body,but in my opinion,it is not so useful as the moom.”
“Why?”asked the lady.
“Because,”replied the gentleman,“the moon affords us light in the might-time,when we really want it,whereas we have the sun always with us in the day-time,when we have not so much meed of it.”</textarea>
  <br>
  小写转大写:
  <textarea name="contentB" rows="8" cols="30">
Arctic Explorer Boy:Dad,when I grow up I want to be an Arctic Explorer.
Father:That's fine,Bill.
Boy:But I want to go into training at once.
Father:And so﹖
Boy:Well,I want a dollar a day for ice-cream so I'll get used to the cold.
</textarea>
  <br>
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</HTML> 请保留地址 http://www.qqread.com/asp/2006/10/s235368.html进入讨论组讨论。
更多专题 【深 度 阅 读】 相 关 文 章
收藏此文】【 】【打印】【关闭
较早的文章:全国IP地址分配表(四)

较新的文章:全套供应
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
巧巧读书宗旨
相关专题
最新论坛文章
站内各频道最新更新文档
站内最新制作专题
热门关键字导读
Photoshop教 程照片处理 照片制作 PS快捷键 抠图
计 算 机 故 障XP系统修复
艺 术 与 设 计设计 流媒体 设计欣赏 边框
计 算 机 安 全ARP
站内频道文章精选
巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章