0

## asp 比對資料

/EELab2018/regist_cmf.asp, 行57

tpay=1600

mschool如果比對"540302"

tpay=1400

mschool 其他
tpay=2000

<%
'mschList="540301"
mschList= Array("540301", "573301", "553301", "120319")
if instr(mschList,mschool) > 0 then
tpay=1600
else
tpay=2000
end if

%>

### 2 個回答

0
kyoe
iT邦新手 5 級 ‧ 2017-11-30 15:33:26

``````<%
'mschList="540301"
mschList= Array("540301", "573301", "553301", "120319")

for each mm in mschList

select case mm
case "540301"
tpay=1100
case "540302"
tpay=1400
case else
tpay=2000
end select

next
%>
``````
0

iT邦大神 1 級 ‧ 2017-11-30 12:14:23

ASP 沒有 InArray 函數

``````<%
'mschList="540301"
mschList= Array("540301", "573301", "553301", "120319")
if in_array(mschool, mschList, false) then
tpay=1600
else
if mschool="540302" then
tpay = 1400
else
tpay=2000
end if
end if

Function in_array(element, arr, performTrim)
Dim i
in_array = False
For i=0 To Ubound(arr)
If performTrim Then '//there are some scenarios where you want to trim
If Trim(arr(i)) = Trim(element) Then
in_array = True
Exit Function
End If
Else '//and other scenarios where you don't
If arr(i) = element Then
in_array = True
Exit Function
End If
End If
Next
End Function
%>
``````