Dec-26-2018, 09:55 PM
i have wanted this function a few times now. so i have started developing one. the needs are more acute than what format() provides.
it needs a hard fixed size the caller can specify. if the number cannot fit in the space, do not enlarge the space or cut off the number. just convert it to as many * characters as needed to fill the space.
the decimal point, shown blank if the given value is int, should line up if it can, or move only to the right (fewer fraction digits) to make a larger number fit.
no trailing 0 digits in the fractional part. " 3.75 " instead of " 3.7500".
caller provides whole field size and preferred number of fraction digits, basically specifying the vertical line up of the decimal point for numbers that fit.
it needs a hard fixed size the caller can specify. if the number cannot fit in the space, do not enlarge the space or cut off the number. just convert it to as many * characters as needed to fill the space.
the decimal point, shown blank if the given value is int, should line up if it can, or move only to the right (fewer fraction digits) to make a larger number fit.
no trailing 0 digits in the fractional part. " 3.75 " instead of " 3.7500".
caller provides whole field size and preferred number of fraction digits, basically specifying the vertical line up of the decimal point for numbers that fit.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.