Which approach you use for this will depend on where your text is and what kind of dataset it’s connected to. Is it a dynamic page? Is it in a repeater?
Also keep in mind you can rewrite your conditional statements like this:
if (0 <= value < 1) { }...