V9.0x 考试系统让答案区分大小写的修改方法(一般英文试卷的答案是要区分大小写的)
打开mnkc/function.asp
找到
'检查正确答案
function checkda(byval useranswer,byval ckda)
useranswer=replace(lcase(replace(useranswer&"",chr(13),""))," ","")
ckda=replace(replace(replace(replace(lcase(ckda&"")," ",""),"<br/>",""),chr(13),""),chr(10),"")
checkda=KS.FoundInArr(ckda,useranswer,"|")
end function
上面整段替换为以下内容
'**************************************************
'函数:FoundInArr
'作 用:检查一个数组中所有元素是否包含指定字符串
'参 数:strArr ----字符串
' strToFind ----要查找的字符串
' strSplit ----数组的分隔符
'返回值:True,False
'**************************************************
Public Function FoundInArr(strArr, strToFind, strSplit)
Dim arrTemp, i
FoundInArr = False
If InStr(strArr, strSplit) > 0 Then
arrTemp = Split(strArr, strSplit)
For i = 0 To UBound(arrTemp)
If (Trim(arrTemp(i))) = (Trim(strToFind)) Then
FoundInArr = True:Exit For
End If
Next
Else
If (Trim(strArr)) = (Trim(strToFind)) Then FoundInArr = True
End If
End Function
'检查正确答案
function checkda(byval useranswer,byval ckda)
useranswer=replace(replace(replace(replace((replace(useranswer&"",chr(13),""))," ",""),"’","'"),"‘","'"),",",",")
ckda=replace(replace(replace(replace(replace(replace(replace((ckda&"")," ",""),"<br/>",""),chr(13),""),chr(10),""),"’","'"),"‘","'"),",",",")
checkda=FoundInArr(ckda,useranswer,"|")
end function
其中的FoundInArr是增加的函数。