dim s as string
来源:百度知道 编辑:UC知道 时间:2024/05/07 18:24:28
dim s as string
s="Btween 2050 and 3000"
s=Val(Mid(s,Instr(s,"2"),4))
请问输出的s到底是什么?还有Mid里面的三项分别表示什么啊?
s="Btween 2050 and 3000"
s=Val(Mid(s,Instr(s,"2"),4))
请问输出的s到底是什么?还有Mid里面的三项分别表示什么啊?
你可以在visual basic 中运用我下面所编的程序
Private Sub Command1_Click()
Dim s As String
s = "Btween 2050 and 3000"
s = Val(Mid(s, InStr(s, "2"), 4))
Print s
End Sub
显示的是2050
Mid 的功能是:返回字符串中指定起始位置和个数的子串
比如Mid("abcdef",3,2)返回字符串"cd"
Mid("abcdef",2,3 )返回字符串"bcd"
在我看来,做Mid的题的时候,比如我第一个举的例子,就是从左边数第三个开始后的两个字母,所以是cd.
现在来讲一讲Instr
比如 Instr(1,"abcdefg","de")返回的是4,因为1代表从abcdefg的第一个字符开始,去找de是第几个出现的,d是从左开始数的第四个,所以返回的是4.
但是你的题中Instr 的括号里只有s和"2",是不是你没写完整? 经过我以上的叙述,相信你会懂的
dim s as string
Dim hstr As String * 1
Dim rttitle As String * 256是什么意思
Dim s As Long中"Long"是什么意思
Dim i As Integer,j As Integer
Dim Number1 As Single, Number2 As Single, Result As Single
Dim rs As New ADODB.Recordset
Dim adorecordset As New ADODB.Recordset
VB中Dim workstation As workspace 是什么意思?
Function FileExists(FileName As String) As Boolean