Resike wrote:NumOfDecimals doesn't seems to work on strings from WebParser:
This gets a little complicated and I admit not terribly intuitive.
The issue is that numeric operations can only be done on "number" values returned by a measure.
Most measures that return numbers as a value return both "string" and "number" values, so Rainmeter can use them either way. If for instance the measure returns 1.12, it can be used as a string in the Text option of a String meter, or as a number in a formula.
Some measures, certainly WebParser and the String measure, ONLY return a "string" value. They have no ability to generate or evaluate what they return as a real number, only as a string. It may happen to "look like" a number, but that doesn't mean anything in the anal-retentive, user-hostile programming in C++ under the covers. A string is a string, and a number is a number, it's about "type", not "value".
What does this mean in a practical sense?
For measures that only return strings you have to "convert" the string to a number to use it in any numeric way, including NumOfDecimals on a String meter.
The only real way to do that is to "pass the string through a Calc measure". The Calc measure is one of the only places in Rainmeter skin code that will evaluate a "numeric string" measure value and convert it to an actual "number".
So this will work:
Code: Select all
Edit: Sorry, didn't notice that balala had really answered this perfectly well before me...