Prior to this, there are many questions asking how to judge the length of the input characters. There are many people who have a lot of people say a one-piece judgment, and there is a full-angle judgment. Two methods: 1: public function getStringLENGTHB (Byval Checkstring As String) As integer
DIM FIRSTB AS STRING DIM AS INTEGER DIM I AS INTEGER DIM Count As INTEGER DIM STRINGLENGTH AS INTEGER DIM STRKANA AS STRING
Strkana = "ア ウエオ ウエオ ウエオ キ キ ケコサシ セソ セソ チ チ ツテ ナ ヌネノハヒフヘホマミム ヌネノハヒフヘホマミム ヨ ヨ ヨ リ リ レ レ ヌネノハヒフヘホマミム ヲ ヨ ァィゥェォャュョ ァィゥェォャュョ ヨ ヨ ヨ ヨ ヨ ヨ ァィゥェォャュョ ァィゥェォャュョ ァィゥェォャュョ ァィゥェォャュョ ァィゥェォャュョ ヨ ヨ ァィゥェォャュョ ヨ ァィゥェォャュョ ァィゥェォャュョ ァィゥェォャュョ ヨ ァィゥェォャュョ ァィゥェォャュョ ヨ ヨ ヨ ヨ ヨ ヨ ヨ ヨ ヨ ヨ ヨ ヨ, ヨ ヨ ヨ ツテ ツテ ナ レ ヨ
StringLength = Checkstring.Length Count = 0
For i = 1 to stringLength firstb = microsoft.visualbasic.mid (Checkstring, i, 1) ASC = Microsoft.VisualBasic.ascw (firstb)
IF ASC <0 or ASC> 255 THEN
If strkana.indexof (firstb) = -1 Then count = count 2 else count = count 1 end if else count = count 1 end if Next
Return Count End Function II: Private Function Getlength (byval Str As String) AS INTEGER DIM EncodingData () AS BYTE
EncodingData = system.text.Encoding.default.getbytes (str) return eNCodingData.length End Function can use the second method for interception of characters, is intercepted by bit, not taking a number. Private Function GetLength (ByVal str As String, Byval length as string) As string Dim encodingData () As ByteencodingData = System.Text.Encoding.Default.GetBytes (str) If length