Hallo zusammen,
kann mir einer sagen wie man in AI Zahlen mit Tausenderseparator darstellen kann?
THX
kann mir einer sagen wie man in AI Zahlen mit Tausenderseparator darstellen kann?
THX
; #FUNCTION# ==================================================================================================================== ; Name...........: _StringAddThousandsSep ; Description ...: Returns the original numbered string with the Thousands delimiter inserted. ; Syntax.........: _StringAddThousandsSep($sString[, $sThousands = -1[, $sDecimal = -1]]) ; Parameters ....: $sString - The string to be converted. ; $sThousands - Optional: The Thousands delimiter ; $sDecimal - Optional: The decimal delimiter ; Return values .: Success - The string with Thousands delimiter added. ; Author ........: SmOke_N (orignal _StringAddComma ; Modified.......: Valik (complete re-write, new function name) ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _StringAddThousandsSep($sString, $sThousands = -1, $sDecimal = -1) Local $sResult = "" ; Force string Local $rKey = "HKCU\Control Panel\International" If $sDecimal = -1 Then $sDecimal = RegRead($rKey, "sDecimal") If $sThousands = -1 Then $sThousands = RegRead($rKey, "sThousand") ;~ Local $aNumber = StringRegExp($sString, "(\d+)\D?(\d*)", 1) Local $aNumber = StringRegExp($sString, "(\D?\d+)\D?(\d*)", 1) ; This one works for negatives. If UBound($aNumber) = 2 Then Local $sLeft = $aNumber[0] While StringLen($sLeft) $sResult = $sThousands & StringRight($sLeft, 3) & $sResult $sLeft = StringTrimRight($sLeft, 3) WEnd ;~ $sResult = StringTrimLeft($sResult, 1) ; Strip leading thousands separator $sResult = StringTrimLeft($sResult, StringLen($sThousands)) ; Strip leading thousands separator If $aNumber[1] <> "" Then $sResult &= $sDecimal & $aNumber[1] EndIf Return $sResult EndFunc ;==>_StringAddThousandsSep