Still struggling with decimal in Calculator

Hey everyone! It´s me again, still struggling with this. I tried a different approach, using IndexOf to check for the presence of the decimal. It sort of works, but still produces side-effects(for instance, it allows one decimal right after the operand) and it still allows things like (0.4.4). Any ideas on how to fix it?

Why are you checking if value contains a decimal? Its a pointless if(). It only matters if newString already contains a decimal point.

Because I want to allow “0.1” and things like that. If I don´t do that additional check, it will stop adding decimals after expressions like “0.1 + (any other number)” so not allowing things like “0.1 + 0.22”

It sort of works, but it still allows this:
0.55+58.8.58.5 and this: 0.+.

Any idea on how to limit that?

Ok, I´m trying to use flags to solve this, but still no budge (it still allows things like 0.55+58.8.58.5 and this: 0.+.). Any ideas?