Code: Alles auswählen
Procedure.s StrAF(number.l)
back.s
t.s = Str(number)
l.l = Len(t)
If Left(t, 1) = "-"
t = Right(t, l-1)
l-1
neg.l = 1
EndIf
If l < 3 ; wenn weniger stellen da sind
t = Left("000", 3-l) + t
l = 3
EndIf
If l <= 4 ; 1 oder 2 Stellen vor dem Komma
If l = 3
back = Left(t, l-2) + "." + Right(t, l-1)
Else
back = Left(t, l-2) + "." + Right(t, l-2)
EndIf
Else
t = Left(t, l-2)
l-2
While l > 3
back = "'" + Right(t, 3) + back
l-3
t = Left(t, l)
Wend
back = t + back
EndIf
If neg
back = "-" + back
EndIf
ProcedureReturn back
EndProcedure
Debug StrAF(2)
Debug StrAF(12)
Debug StrAF(342)
Debug StrAF(3472)
Debug StrAF(83472)
Debug StrAF(344472)
Debug StrAF(123456789)
Debug StrAF(-2)
Debug StrAF(-12)
Debug StrAF(-342)
Debug StrAF(-3472)
Debug StrAF(-83472)
Debug StrAF(-344472)
Debug StrAF(-123456789)
Code: Alles auswählen
0.02
0.12
3.42
34.72
834
3'444
1'234'567
-0.02
-0.12
-3.42
-34.72
-834
-3'444
-1'234'567