10-25-2018 05:49 AM - edited 10-25-2018 05:58 AM
Hi to all. I have a question about formatString property when it form a number on indicator or "FormatToString" function.
How can I known the number lenght in simbols by it format string? In some cases it's easy: "%10d" - 10 symbols, but how it works in more complex cases, like "%010_7f" or "%f" or "%g"?
And how calculate symbols after point by formatString?
10-25-2018 05:51 AM
10-25-2018 06:32 AM
@GerdWuse StringLength after...
I want to know it before the function is done.
10-25-2018 07:06 AM - edited 10-25-2018 07:07 AM
Hi Forest,
then you need to analyze your data - it is much easier to check after the conversion to string…
Example:
- value of 1 with a format of %g gets converted to "1.000000" (8 chars)
- value of 1 with a format of %#g gets converted to "1" (1 char)
- value of 1 with a format of %#3g gets converted to " 1" (3 chars)
- value of 1.001 with a format of %#3g gets converted to "1.001" (5 chars)
It is much easier to check string length after conversion than to analyze all possible input data with all possible format strings…
10-25-2018 11:07 AM
@GerdW wrote:
then you need to analyze your data - it is much easier to check after the conversion to string…
Not is it just easier, but a lot of the analysis would require at least most, if not all, of the conversion already. So you might as well check it after the conversion and make your like A LOT simpler.
10-25-2018 12:36 PM
Number of desimal points I calculate like this:
And its work in many cases.
10-25-2018 01:58 PM
@0Forest0 wrote:
Number of decimal points I calculate like this:
And its work in many cases.
So you convert two strings into numbers to figure out the decimal length. Again, that seems wasteful. Just convert the original number and use Search/Split String and String Length to get your decimal length.
10-25-2018 02:44 PM
When I prepare long string of values I don't know what values (big or not) will convert to string. But I shall put numbers on exactly positions in result string. Then I should know lenght of result string basing on formats of containing values.