Mistři v programování na #hovnokod

Visual Basic #551

Public Function GetFormatedValue(ByVal columnName As String, ByVal value As Object) As String
	Dim result As String = value.ToString()
	Dim vint As Integer
	If (TypeOf value Is Decimal) Then
		vint = CType(CType(value, Decimal), Integer)
	ElseIf (TypeOf value Is Integer) Then
		vint = CType(value, Integer)
	Else
		vint = CType(Decimal.Parse(value.ToString(), System.Globalization.CultureInfo.InvariantCulture), Integer)
	End If

	Dim stringValue = ConvertStringToInt(value)

	Select Case foundedColumn.Format
		Case "3"
			result = String.Format("${0}M", GetSplitValue(CType(CType(stringValue, Integer) / 1000000, Integer)))
		Case "2"
			result = String.Format("${0}K", GetSplitValue(CType(CType(stringValue, Integer) / 1000, Integer)))
		Case "1"
			result = String.Format("${0}", GetSplitValue(vint))
	End Select
	Return result
End Function

Private Function ConvertStringToInt(ByVal value As Object) As String
	Return CType(value, String).Replace(",", String.Empty).Replace(".", String.Empty).Replace(" ", String.Empty)
End Function

HovnoKod,