Andy Jr. Andy Jr. - 1 year ago 63
C# Question

How to slice/trim this value?

I am trying to remove the last 6 characters from

because the data has a decimal place and 5 trailing 0s in the database.

sb.Append("<div>" + item.Size + " " + item.Units + "&nbsp;</div>");

ie. item.Size is displayed as 1.00000 and I need it to just be displayed as 1.

This is part of a StringBuilder, and as I'm new to coding, not even sure the right way to go about this.

Answer Source
sb.Append("<div>" + (int)item.Size + " " + item.Units + "&nbsp;</div>");