如何取得字符串中字符长度
来源:互联网 发布:新加坡网上购物软件 编辑:程序博客网 时间:2024/05/16 16:12
Function LengthOfString(str)
Dim l,c,i,t
LengthOfString = 0
If str="" Then Exit Function
l=Len(str)
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
If c>255 then
t=t+2
Else
t=t+1
End If
Next
LengthOfString = t
End Function
dim a,b
a="admin"
b="中国"
Response.Write LengthOfString(a) '输出:5
Response.Write("<br>")
Response.Write LengthOfString(b) '输出:4
Dim l,c,i,t
LengthOfString = 0
If str="" Then Exit Function
l=Len(str)
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
If c>255 then
t=t+2
Else
t=t+1
End If
Next
LengthOfString = t
End Function
dim a,b
a="admin"
b="中国"
Response.Write LengthOfString(a) '输出:5
Response.Write("<br>")
Response.Write LengthOfString(b) '输出:4
- 如何取得字符串中字符长度
- 如何取得字符串最后一个字符
- 取得字符串长度
- 如何取得字符在字符串中最后一次出现的位置?
- 在C#中取得指定长度的字符串
- Perl中取得字符串长度的函数length
- 在C#中取得指定长度的字符串
- Perl中取得字符串长度的函数length
- 在C#中取得指定长度的字符串
- Perl中取得字符串长度的函数length
- 如何获取NSString的字符长度以及如何获取指定字符长度字符的字符串
- 取得固定长度字符串C#
- vc取得unicode字符串长度
- php取得字符串长度函数
- 取得字符串的字节长度
- java中如何计算一个字符串的byte长度(一个汉字多少字符)
- 取得长度为length的字符串,一个汉字算两个字符
- 取得长度为length的字符串,一个汉字算两个字符
- 水晶按钮的实现
- SVG And Expat
- 辞职报告
- 8月份请关注我的新书《ASP.NET 2.0 网站开发技术详解》
- Linux 下安装字体
- 如何取得字符串中字符长度
- 70个JAVA问答
- Apress.Beginning.Ruby.on.Rails.E.Commerce.From.Novice.to.Professional
- [WinForm每日一帖] UltraGrid大数据量的绑定
- Delphi 字符串操作
- 清华给美国培养工程师,北大给美国培养老婆?
- 使用XML示例
- The C assert( ) macro (C语言的一种宏应用:断言)
- 嵌套类MYEX.