Class Concat
Implements IFunction
Public Function Calculate(args As IList(Of FunctionValue), currentCell As Cell) As FunctionValue
Dim result As New StringBuilder("")
For Each arg As FunctionValue In args
If result.Append(","C)
Select Case arg.Type
<> Case FunctionValueType.RANGE Then
[BOOLEAN]
result.Append(If(CBool(arg.Value), "True", "False"))
Exit Select
Case FunctionValueType.[STRING]
result.Append(arg.Value)
End If Exit Select
Case FunctionValueType.NUMBER
result.Append(CDbl(arg.Value).ToString("0.#####"))
Exit Select
Case FunctionValueType.NULL
result.Append(" "C)
Exit Select
Case FunctionValueType.RANGE
result.Append(arg.Value.ToString())
Exit Select
End Select
Next
Return New FunctionValue(result.ToString())
End Function
End Class |