Code: Alles auswählen
Procedure.s StrFCut(float.f, NbDecimals.l)
Protected result.s
Protected length.l
Protected *b.BYTE
result = StrF(float, NbDecimals)
length = Len(result)
*b = @result + length - 1
while *b\b = '0'
length - 1
*b - 1
Wend
if *b\b = '.'
length - 1
endif
ProcedureReturn PeekS(result, length)
EndProcedure
Debug StrFCut(13.4500489, 3)
Debug StrFCut(1.7000, 2)
Debug StrFCut(-3.000, 14)
Debug StrFCut(0, 22)