问题 单项选择题

一下面函数的功能应该是:删除字符串str中所有与变量ch相同的字符,并返回删除后的结果。例如:若str= "ABCDABCD", ch= "B",则函数的返回值为:"ACDACD"  Function delchar(str As String, ch As String)As String  Dim k As Integer, temp As String, ret As String  ret=""  For k=1 To Len(str)  temp=Mid(str, k, 1)  If temp= ch Then  ret=ret&temp  End If  Next k  delchar=ret  End Function  但实际上函数有错误,需要修改。下面的修改方案中正确的是

A.把ret=ret&temp改为ret=temp

B.把If temp=ch Then改为If temp<> ch Then

C.把delchar=ret改为delchar=temp

D.把ret =""改为temp=""

答案

参考答案:B

单项选择题 A1/A2型题
单项选择题