Set precision of shown attribute in autocad dynamic block - block

I made a blog that shows it current with and height in the displayed thext.
Now they have 4 decimal places (for example 5.600), see picture below.
I want them displayed with only 1 decimal place, how can i do this?
(example below would become 5.6x16.5 in stead of 5.6000x16.5000)

You can either modify the Precision property of the Field formatting so as to round the result to 1 decimal place:
Or, if you were looking to retain the precision, you could instead suppress trailing zeroes within the Additional Format options:
Alternatively, assuming that your formatting is set to Current units, you could change the value of your LUPREC system variable.

Related

Is format ####0.000000 different to 0.000000?

I am working on some legacy code at the moment and have come across the following:
FooString = String.Format("{0:####0.000000}", FooDouble)
My question is, is the format string here, ####0.000000 any different from simply 0.000000?
I'm trying to generalize the return type of the function that sets FooDouble and so checking to make sure I don't break existing functionality hence trying to work out what the # add to it here.
I've run a couple tests in a toy program and couldn't see how the result was any different but maybe there's something I'm missing?
From MSDN
The "#" custom format specifier serves as a digit-placeholder symbol.
If the value that is being formatted has a digit in the position where
the "#" symbol appears in the format string, that digit is copied to
the result string. Otherwise, nothing is stored in that position in
the result string.
Note that this specifier never displays a zero that
is not a significant digit, even if zero is the only digit in the
string. It will display zero only if it is a significant digit in the
number that is being displayed.
Because you use one 0 before decimal separator 0.0 - both formats should return same result.

typo3 fluid format number without trailing zeros

In my typo3 extension I got a double value saved via backend. I want to put this value out in the frontend.
I want the double to be formated to use the german ',' as decimal seperator (and a max precision of 1). So I used f:format.number viewhelper to set this. However that fluid helper ist setting fixed decimals. I want dynamic decimals, as in I do not want any trailing 0s. 4.0 ought to be shown as 4.
If I do not use the viewhelper (thus outputting the raw data) the behaviour is as desired. 4.0 shows as 4, however it also does show 4.5 as 4.5 not as 4,5.
Is there a way to 'unfix' the decimals in the viewhelper?
I also tried to wrap my output in if conditions to check via modula, but this never returns a positive.
How do I output formated doubles on a precision without trailing zeros?
For just one digit (like in your example) the following code worked for me. For a double, you have to nest another if-condition in the else case since there is no else-if in fluid.
<f:if condition="{number} == {number -> f:format.number(decimals: 0)}">
<f:then>
<f:format.number decimals="0" decimalSeparator=",">{number}</f:format.number>
</f:then>
<f:else>
<f:format.number decimals="1" decimalSeparator=",">{number}</f:format.number>
</f:else>
</f:if>

Formatting a decimal variable to decimal places loses formatting in firefox

I have a decimal variable value I set scale two decimal places that is displayed into an input field. The visualforce page uses dynamic updating of this field and it works great. The problem is when I use firefox all decimal fomatting is removed, its like it turns to an int. (the inclusivePriceDisplay populates the incl input field). I cannot use the currency formatting field because of a calculation I am not saving to the record as one of my fields, inclusivePrice is not included on any object so does not have the salesforce currency formatting.
how it looks ext class:
decimal inclusivePriceDisplay= inclusivePrice.setScale(2, RoundingMode.HALF_UP);
How it looks VFP:
<apex:input required="true" value="{!inclusivePriceDisplay}" type="number" label="{!$Label.InclPrice}">
</apex:input>
How it looks on Chrome:
How it looks firefox:
Its like if its a whole number it refuses to put the trailing zeros and the decimal. I even initialize the variables to 0.00 and it only shows to 0. However if the decimal should be more than 2 decimals it will show 2 decimals but if it is like $1.10 (a dollar and ten cents) it will only show 1.1.

What does %2.6f do in Objective C String Formatting?

Based on Apple's documentation here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Strings/Articles/FormatStrings.html
It's pretty easy to understand the number to the right of the decimal point is the number of digis will be rounded up...
For example, %1.2f, 123456.123456 will turn out 123456.12 and %1.4f will turn out 123456.1234...
But it looks like the number to the left of decimal does nothing.
I tried changing the number to whatever I can think of, nothing happened.
What does it do?
The number before the decimal point in the format is called the format string's width. That is, if the resultant string would involves less characters than its width, it will be left-padded with blank spaces. You don't see any change because you either aren't using a high enough number (try something ridiculous like 100 or 200), or don't have a means of properly seeing your whitespace.

Handling measurement units in NSTextField

I am creating a test application to calculate the area of a rectangle.This application uses NSTextField control to get the length and breadth of rectangle.
The user is expected to enter a string value which will include units of length as well (Sample Values 2.5 inches, 1500 mm).
I want NSTextField to convert the value in centimeters (cm) automatically so that it displays the converted value (in cm) as soon as the text field looses focus.
For Eg:
User Enters length as: 1500 mm
As soon as user goes to next text field to enter breadth, the length field displays
Displayed Value: 150 cm
How can we achieve this?
I think you want to use the delegate method, controlTextDidEndEditing:, which is sent to your text field's delegate when the editing is finished. Once you get the string from the field editor, you'll need to parse it somehow to find the units (how you parse it depends on what all you need to find). If you have a small number of things you're hunting for, like cm, mm, m, then you could probably just use rangeOfString: and test for 0 length to find out what units were entered. BTW, you should do your math correctly too -- 1500mm = 150 cm
I would consider a different approach, using a UIPicker to display the available units, and have them enter the number separately.
Otherwise, you'll have to do all this parsing. Don't see the point of parsing. Plus, if they make a mistake spelling the units, or use different ways of indicating it, then you would have to account for that as well. Depends on your application, but if the user has to type the units out anyway, it might be more convenient for them to use a UIPicker.