Lasso Soft Inc. > Home

[ decimal->asString ]

Method

The [decimal->asString] method formats the decimal as a string. This method replaces the [Decimal->SetFormat] tag from Lasso 8.x and earlier. In Lasso 9 integers and decimals have no state, and so they cannot carry around their formatting information.

Parameter Description
-Precision Specifies the desired number of characters of precision. By default values are output with 6 characters of precision.
-DecimalChar Specifies the desired character to use as a decimal point. Defaults to a period.
-GroupChar Specifies the desired character to use for thousands grouping. Defaults to the empty string so thousands grouping is not performed.
-Padding Specifies the desired width in character of the output.
-PadChar Specifies the character to use to pad the output. Defaults to a space.
-PadRight If set to True the output will be padded on the right. By default the output will be padded on the left.
-Scientific If set to True, the output will be in scientific notation. By default, scientific notation will only be used if required.
  • Syntax
Decimal Value->asString(
	-decimalChar = 'Character Value',
	-groupchar = 'Character Value',
	-precision = Integer Value,
	-scientific = Boolean Value,
	-padding = Integer Value,
	-padChar = 'Character Value',
	-padRight = Boolean Value
)
Examples
  • Beginner

To format a decimal as a string:

Use the [decimal->asString] method. The following example formats a decimal as a string.

Code

999999.95555->asString(
  -precision=2, 
  -GroupChar=','
)

Result

999,999.96

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft