Is it possible for an expression to recognise when a number (provided by an expression slider) has a zero as decimal (i.e. 2.0) and then remove the decimal point and zero (i.e. 2 ) but keep them if the number is 2.5 (for example). I kind of think it would need an If/else statement but I'm not sure how to make it recognise .0 if this is possible at all?
Any help would be greatly appreciated (and save me pulling out all my hair) thanks,
I work in Germany so the decimal point is actually a comma. I then wanted to add a percentage sign (%) to this and I got stuck again. Simply adding +"%" messed up the comma and the removal of the zero decimal. I tried
n = effect("Slider Control")("Slider").value.toFixed(1).replace("." , ",");
n[n.length-1] == "0" ? n.substr(0,n.length-2) : n +"%"
which works well untill there is a decimal zero but the decimal zero and the % dissappear
Any Ideas? I'm sure I'm overlooking something simple.
This is actually one of several improvements I'm making on a german election after effects project which you helped me out with a couple of years ago! Back then after recieving so much help from the creative cloud forums I offered the project to anyone who wanted it and a couple of people got in touch, so I sent it to them. If I manage to get this sorted out again, anyone who needs an "election rig" can get in touch and I'll send it out.
Thanks again for your help