Cast Currency Format To String

Hi All,

I have a condition where I need to check if the amount values $1.00 is present bot should filter it out and exclude it. How can I convert it to string . I have used below condition:
io_dt_TransactionData.AsEnumerable().
Where(Function(row) row.Field(Of String)(“Amount”) > “$1.00”).ToList()

Hi @dutta.marina

Try this

io_dt_TransactionData.AsEnumerable().
Where(Function(row) Convert.ToDecimal(row.Field(Of String)("Amount").Replace("$", "")) > 1.00).
CopyToDataTable()

Regards,

1 Like

@dutta.marina

io_dt_TransactionData = io_dt_TransactionData.AsEnumerable().
Where(Function(row) Convert.ToDecimal(row.Field(Of String)("Amount").Replace("$", "")) > 1.0).
CopyToDataTable()

Please use this linq query

1 Like

Local Formats handling we always recommend to handle it with CultureInfo

String Manipulations can risk side effects

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.