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
result.Append(","C)
Select Case arg.Type
Case FunctionValueType.[BOOLEAN]
result.Append(If(CBool(arg.Value), "True", "False"))
Exit Select
Case FunctionValueType.[STRING]
result.Append(arg.Value)
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 |