top of page

# 03. Decimal numbers without the preceding "0"

# Description

Removes the preceding "0" from decimals less than 1 (e.g. "0.75" -> ".75").

# Code

""

FORMAT( Number-n , "" )

IF FIRST( RESULT , 2 ) = "0."

LAST( RESULT , LENGTH( RESULT ) - 1 )

END IF

Alternative

"«Number-n»"

IF FIRST( RESULT , 2 ) = "0."

LAST( RESULT , LENGTH( RESULT ) - 1 )

END IF

# Explanation

This computation converts the number, Number-n, into a string, and then tests it to see whether it begins with "0.". If so, it returns only the portion of the string from the decimal to the end. Otherwise it returns the whole string. Note that the result is a Text value, not a Number value.

bottom of page