将全角的字符转变成半角字符,将半角转变成全角
<%
Function DSConvert(vString,vFlag)
Rem vFlag为0时表示从全角转为半角,为其他时表示从半角转为全角
Dim i,tmpSingleCharaASC,TempResult,SAscString,DAscString
SAscString = "1,2,3,4,5,6,7,8,14,15,16,17,18,19,20,21,22,23,24,25,26,27,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126"
DAscString = "-23679,-23678,-23677,-23676,-23675,-23674,-23673,-23672,-23666,-23665,-23664,-23663,-23662,-23661,-23660,-23659,-23658,-23657,-23656,-23655,-23654,-23653,-23647,-23646,-23645,-23644,-23643,-23642,-23641,-23640,-23639,-23638,-23637,-23636,-23635,-23634,-23633,-23632,-23631,-23630,-23629,-23628,-23627,-23626,-23625,-23624,-23623,-23622,-23621,-23620,-23619,-23618,-23617,-23616,-23615,-23614,-23613,-23612,-23611,-23610,-23609,-23608,-23607,-23606,-23605,-23604,-23603,-23602,-23601,-23600,-23599,-23598,-23597,-23596,-23595,-23594,-23593,-23592,-23591,-23590,-23589,-23588,-23587,-23586,-23585,-23584,-23583,-23582,-23581,-23580,-23579,-23578,-23577,-23576,-23575,-23574,-23573,-23572,-23571,-23570,-23569,-23568,-23567,-23566,-23565,-23564,-23563,-23562,-23561,-23560,-23559,-23558,-23557,-23556,-23555,-23554"
TempResult = ""
If Len(vString) <= 0 Then Response.Write "Parameters Error! Please Check Your Parameters!" : Response.End : Exit Function
For i=1 to Len(vString)
tmpSingleCharaASC = Asc(Mid(vString,i,1))
If vFlag = 0 Then
If InStr(DAscString,tmpSingleCharaASC) <> 0 and len(Cstr(tmpSingleCharaASC)) = 6 Then
TempResult = TempResult & Chr(tmpSingleCharaASC+23680)
Else
TempResult = TempResult & Chr(tmpSingleCharaASC)
End If
Else
If InStr(SAscString,tmpSingleCharaASC) <> 0 and Len(Cstr(tmpSingleCharaASC))<=4 Then
TempResult = TempResult & Chr(tmpSingleCharaASC-23680)
Else
TempResult = TempResult & Chr(tmpSingleCharaASC)
End If
End If
Next
DSConvert = TempResult
End Function
%>
全角转半角
<%= DSConvert("1234566465454",0)%>
半角转全角
<%= DSConvert("1234567890132131",1)%>
asp将全角的字符转变成半角字符,将半角转变成全角的代码
2019-09-30 15:06asp代码网 ASP教程
asp将全角的字符转变成半角字符,将半角转变成全角d的代码
延伸 · 阅读
- 2019-09-30asp实现dig功能的js代码
- 2019-09-30asp创建表,复制表 字段类型附录
- 2019-09-30asp加密解密函数decrypt
- 2019-09-29asp获取当前网页地址的代码
- 2019-09-29asp下经常用到的代码
- 2019-09-29asp 的中文分词
精彩推荐
- ASP教程
ASP javascript Application对象的Contents和StaticObjects做Cache的一些经验
ASP javascript: Application对象的Contents和StaticObjects做Cache的一些结论。 ASP封装Cache对象,一般都是基于Application的, ...
- ASP教程
ASP随机数RND()使用方法
函数RND()是一个非常重要的函数。如果你想建立一个随机的问候语,一个日期的随机提示,或者甚至一个游戏,你将要使用这个函数...
- ASP教程
asp中使用redim、preserve创建动态数组实例
这篇文章主要介绍了asp中使用redim、preserve创建动态数组实例,本文还给出了ASP中其它的数组操作例子,需要的朋友可以参考下...
- ASP教程
使用innerHTML时注意处理空格和回车符(asp后台处理)
innerHTML中如果包含空格和回车都会被认为是段落的结束,造成程序运行出错,解决办法,输出的时候将空格和回车替换掉,方便js调用。...
- ASP教程
ASP开发基于XML的留言板
XML(Extensible Markup Language)是一种基于文本格式的标记语言,它注重对数据结构和数据意义的描述,实现了数据内容和显示样式的分离,而且是与平台无关的。下面利用XML作为数据的载体,开发一个基于XML的留言板。...
- ASP教程
用ASP实现MSSQL用户密码破解
一个暴力破解MSSQL用户密码的ASP程序,最早发布在EST论坛。以下这个版本是可以运行之后关闭浏览器,运行完毕将在当前目录生成结果文件的。 用ASP做事情效率很慢,当然这个程序所体现的不是它的效率,而是……给你点悬念,不...
- ASP教程
asp去除html的函数代码分析附实例说明
asp去除html的函数代码分析附实例说明,经脚本之家编程测试确实好用。...
- ASP教程
asp 根据IP地址自动判断转向分站的代码
根据IP地址自动判断转向分站的代码 这个是一个不错的解决之道,可以缓解服务器压力过大等一些问题 ...