Function f(ByVal x As String, ByVal y As Integer, ByVal z As Integer, ByVal w As Integer, ByRef t As String) As String
If Length(x) < w Then // Definition for Length below
Return t
End If
If y = z Then
t = t + SubStr(x, w, 1) // Definition for SubStr below
z = 1
Else
z = z + 1
End If
w = w + 1
Return f(x, y, z, w, t)
End Function
Function f1(ByVal x As String, ByVal y As Integer) As String
Return (f(x, y, 1, 1, ""))
End Function
我不是VB程序员,但我在很大程度上假设语法是C,我从非技术招聘人员那里收到了以下输入 f1(“enritcde3 dtyeds4t8”,2) )。根据我的理解,以下输出将是(“enritcde3 dtyeds4t8”,2,2,2,“”) 。我错过了什么吗?
答案 0 :(得分:2)
只需将其转换为Vb.Net,输出就是“不错的测试”。
解析字符串中的偶数位置字符,不包括空格。
答案 1 :(得分:-1)
代码块中有两个功能。 f1函数只有2个参数,然后使用z,w和t参数的硬编码值调用f函数。所以,从某种意义上说,你是对的。