asp.net 按字节检查包含全半角的文字
时间:2021-01-28 10:26:58|栏目:.NET代码|点击: 次
'''------------------------------------------------------------------------
''' <summary>
''' 文字列?L检查(按字节检查)
''' </summary>
''' <param name="argStrControl">文字列</param>
''' <param name="argLength">文字列?L</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
'文字列?L
Dim iLength As Integer = 0
iLength = pEncoding.GetBytes(argStrControl).Length()
'文字列?L检查
If argLength < iLength Then
Return False
End If
Return True
End Function
''' <summary>
''' 文字列?L检查(按字节检查)
''' </summary>
''' <param name="argStrControl">文字列</param>
''' <param name="argLength">文字列?L</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
'文字列?L
Dim iLength As Integer = 0
iLength = pEncoding.GetBytes(argStrControl).Length()
'文字列?L检查
If argLength < iLength Then
Return False
End If
Return True
End Function
上一篇:Visual Studio 2013+OpenCV2.4.10环境搭建教程
栏 目:.NET代码
下一篇:详解Spring Boot 中使用 Java API 调用 lucene
本文地址:http://www.codeinn.net/misctech/52927.html