扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
res = "" For i = 1 to 10000: res = res & Str(i): Next |
Dim res As String Dim i As Long Dim index As Long ’预留足够长的缓冲空间 res = Space(90000) ’指针变量,指出在哪里插入字符串 index = 1 ’循环开始 For i = 1 to 10000 substr = Str(i) length = Len(substr) ’填充字符串的相应区间段数值 Mid$(res, index, length) = substr ’调整指针变量 index = index + length Next ’删除多余字符 res = Left$(res, index - 1) |
Dim col As New Collection, i As Long For i = 1 To 10000 col.Add i, CStr(i) Next |
For i = col.Count To 1 Step -1 col.Remove i Next |
For i = 1 To col.Count Step 1 col.Remove i Next |
Set col = New Collection |
If UCase$(char) = "A" Or UCase$(char) = "E" Or UCase$(char) = "I" Or UCase$(char) = "O" Or UCase$(char) = "U" Then ’ it is a vowel End If |
If InStr("AaEeIiOoUu", char) Then ’ it is a vowel End If |
If LCase$(word) = "winter" Or LCase$(word) = "spring" Or LCase$(word) = _ "summer" Or LCase$(word) = "fall" Then ’ it is a season’s name End If |
If Instr(";winter;spring;summer;fall;", ";" & word & ";") Then ’ it is a season’s name End If |
Select Case LCase$(word) Case "zero" result = 0 Case "one" result = 1 Case "two" result = 2 Case "three" result = 3 Case "four" result = 4 Case "five" result = 5 Case "six" result = 6 Case "seven" result = 7 Case "eight" result = 8 Case "nine" result = 9 End Select |
result = InStr(";zero;;one;;;two;;;three;four;;five;;six;;;seven;eight;nine;", _ ";" & LCase$(word) & ";") \ 6 |
If SomeVar > SomeOtherVar Then BoolVal = True Else BoolVal = False End If |
BoolVal = (SomeVar > SomeOtherVar) |
If SomeVar > SomeOtherVar Then x = x + 1 End If |
x = x - (SomeVar > SomeOtherVar) |
Function Max(arr() As Long) As Long Dim res As Long, i As Long res = arr(LBound(arr)) For i = LBound(arr) + 1 To UBound(arr) If arr(i) > res Then res = arr(i) Next Max = res End Function |
Function Max(arr() As Long) As Long Dim i As Long Max = arr(LBound(arr)) For i = LBound(arr) + 1 To UBound(arr) If arr(i) > Max Then Max = arr(i) Next End Function |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者