全角英文转为半角

作者:袖梨 2022-07-02


将全角转为半角,半角转为全角



<%
'---------------------------------------
'编写:johnsun Email:[email protected]
'语言: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)

相关文章

精彩推荐