I have a numeric string like this 2223,00. I would like to transform it to 2223. This is: without the information after the “,“. Assume that there will be only two decimals after the “,“.
I did:
str = str.Remove(str.Length - 3, 3);
Is there a more elegant solution? Maybe using another function? -I don´t like putting explicit numbers-
You can actually just use the Remove overload that takes one parameter:
However, if you’re trying to avoid hard coding the length, you can use: