海信家电”换帅 “ 高玉玲接替代慧忠出任新任董事长
2024-11-22
Dim str As String str = "Give me a 美女" Dim L1 As Long Dim L2 As Long L1 = Len(str) L2 = LenB(str) Debug.Print L1, L2 |
Dim str As String str = "Give me a 美女" Dim L1 As Long Dim L2 As Long L1 = Len(str) L2 = LenB(str) Debug.Print L1, L2 TextOut Me.hDC, 100, 100, str, L1 |
Private Declare Function LenANSI Lib "kernel32" Alias "lstrlenA" (ByVal string1 As String) As Long …… Dim str As String str = "Give me a 美女" Dim TrueLen As Long TrueLen = LenANSI(str) TextOut Me.hDC, 100, 100, str, TrueLen |
Const vbNullChar = "" |
Dim s1 As String Dim s2 As String Dim s3 As String s1 = vbNullString s2 = vbNullChar s3 = "" Debug.Print StrPtr(s1), StrPtr(s2), StrPtr(s3) Debug.Print LenB(s1), LenB(s2), LenB(s3) |
天下第七帅按下F5后,他很惊讶海蛇代码的运行结果
0 1899284 1434596
0 2 0
那么就是说VB的说明和海蛇之间一定有人错了。而且,对于采用S1两个值都是零,指针指向零,长度为零,它不是一个普通意义上的零值呀。
天下第七帅于是转过头来看着我。
“小子,出风头吧,来吧,我先给你们看点东西”
“你们想要打败海蛇,就一定要了解海蛇的结构”
VB的字符串是一个标准的BSTR字符串,比如说”Hello”这个字符串它的结构是这样的
A | 0 |
0 |
0 |
‘H |
0 |
‘e' |
0 |
‘l' |
0 |
‘l' |
0 |
‘o' |
0 |
0 |
0 |
Modules->Modules Constants |
[helpcontext(0x0010aa32)] const LPSTR vbNullString = ""; [helpcontext(0x0010aa32)] const LPSTR vbNullChar = "\0"; |
s1 = vbNullString |
s2 = vbNullChar |
s3 = "" |
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交