欢迎光临
我们一直在努力

全角英文转为半角

建站超值云服务器,限时71元/月

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 全角英文转为半角
分享到: 更多 (0)