# Function: Str

### Description

Converts a number to a string.

### Syntax

Str(number[,length[,decimals[,fillchar]]])

### Arguments

number is the number to convert. The number can be a constant, a numeric field, an expression that results in a number or a function that returns a number.

length specifies the length of the resulting string. The length must be in the range 1 - 256.

decimals specifies the decimal position to round.

fillchar specifies the fill character to use to fill up to the length specified. Note: fillchar is optional.

### Return value

This function returns a character string.

### Calculated field example

If the Unit_price field contained the value 159.95, the following calculated field expression would return " 160": Str(Unit_price,6,0)

Note: If there is no fill character specified, the Str function pads the result with leading spaces to match the string length specified. You must ensure that a proper data length is selected for the calculated field.

If the Unit_price field contained the value 159.95, the following calculated field expression would return "***160": Str(Unit_price,6,0,"*")

### Filter/Find example

Records with a Unit_price field value of 99.95 or 100.32 can be selected or found using the expression: Str(Unit_price,3,0)="100"

© 2024 Altair Engineering Inc. All Rights Reserved.