首页 > 编程 > .NET > 正文

asp.net 按字节检查包含全半角的文字

2020-01-18 01:20:09
字体:
来源:转载
供稿:网友
'''------------------------------------------------------------------------
''' <summary>
''' 文字列检查(按字节检查)
''' </summary>
''' <param name="argStrControl">文字列</param>
''' <param name="argLength">文字列</param>
''' <returns>True - , False - </returns>
''' <remarks></remarks>
'''------------------------------------------------------------------------
Public Shared Function CheckControlLength(ByVal argStrControl As String, _
Optional ByVal argLength As Integer = 0) As Boolean
'NULL
If String.IsNullOrEmpty(argStrControl) Then
Return True
End If
'文字列
Dim iLength As Integer = 0
iLength = pEncoding.GetBytes(argStrControl).Length()
'文字列检查
If argLength < iLength Then
Return False
End If
Return True
End Function
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表