> Hello Everyone

>

> I want to convert 15.398 to character format

>

> - The number of decimal places is not Known it could be 3,4,5 or more

>

> - STR(15.398,12,5) Result is 15.39800 is not acceptable I need the result as 15.398

>

> - STR(15.390,12,5) Result is 15.39000 is not acceptable I need the result as 15.390

>

> How can this be carried out?

>

> Regards

Try this function to get the character format of a number. Minimum decimal places defaults to 3

clear
?cNumber(15.39800)
?cNumber(15.39000)
?cNumber(234.56789108000)
?cNumber(234.567890000)
?cNumber(234.56)
?cNumber(234,2)
FUNCTION cNumber(nNumber,minDecPlaces)
minDecPlaces = evl(minDecPlaces,3)
local i,cnumber
cnumber = str(nNumber,20,10)
i =len(m.cnumber)
do while m.i > at(".",m.cnumber)+minDecPlaces and substr(m.cnumber,m.i,1) = "0"
i = m.i-1
enddo
cnumber = left(m.cnumber,m.i)
RETURN ltrim(m.cnumber)

Tony