asp.net 实现按字节检查包含全半角的文字的代码
来源:不详 责任编辑:栏目编辑 发表时间:2013-07-01 03:17 点击:次
'''------------------------------------------------------------------------
''' <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
''' <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
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>