VB问题,急!急!急!在线等

2024-12-16 04:47:12
推荐回答(3个)
回答1:

第一个参见楼上的。其实可以简化为
IFint=iif(a mod 2=0,True,False)

第二有个简单方法,就是使用反转函数。
if str=StrReverse(Str) then
msgbox "yes"
else
no
endif

更简单点 yesorno=iif(str=StrReverse(Str),"True","false")

回答2:

1.
private function IFint(a as int )as boolean
if (a mod 2)=0 then
IFint=True
else
IFint=False
end if
end function

2.
Private Function IFstr(str As String) As Boolean
Dim n As Integer
n = Len(str)
For i = 1 To Int(n / 2)
If Mid(str, i, 1) <> Mid(str, n + 1 - i, 1) Then
IFstr = False
Exit For
Else
IFstr = True
End If
Next i
End Function

回答3:

1/再简化
private function IFint(a as int )as boolean
ifint = a mod 2 = 0
end function