2byte 언어의 경우 알아서 계산..
Function LengthinBytes(ByVal strString)
Dim i, strChar
LengthinBytes = 0
For i =1 To Len(strString)
strChar = Mid(strString, i, 1)
If Asc(strChar) > 255 OR Asc(strChar) < 0 Then
LengthinBytes = LengthinBytes + 2
Else
LengthinBytes = LengthinBytes + 1
End If
Next
End Function
Dim i, strChar
LengthinBytes = 0
For i =1 To Len(strString)
strChar = Mid(strString, i, 1)
If Asc(strChar) > 255 OR Asc(strChar) < 0 Then
LengthinBytes = LengthinBytes + 2
Else
LengthinBytes = LengthinBytes + 1
End If
Next
End Function
이를테면,.
LengthinBytes("한글1") 하면 5byte
또는 COM 개체를 이용하는 경우에는,.
Set objCmdLib = CreateObject("Microsoft.CmdLib")
Set objCmdLib.ScriptingHost = WScript.Application
wscript.echo objCmdLib.LengthinBytes("한글1")
Set objCmdLib.ScriptingHost = WScript.Application
wscript.echo objCmdLib.LengthinBytes("한글1")
댓글 없음:
댓글 쓰기