UKismetTextLibrary::AsCurrency_Float
Deprecated: Use AsCurrencyBase instead.
#include "Kismet/KismetTextLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Formats a float value as currency text using the given rounding and number formatting options. The engine source marks this DEPRECATED in favor of AsCurrencyBase.
Caveats & Gotchas
- • Marked deprecated in the Blueprint node display name ('AsCurrency (float) - DEPRECATED (use AsCurrency)') — new code should call AsCurrencyBase instead.
- • Formatting monetary values with a binary float is prone to rounding artifacts (e.g. 2.675 not representing exactly); AsCurrencyBase's integer smallest-unit approach avoids this entirely.
- • An empty CurrencyCode falls back to the current culture's default currency.
Signature
static FText AsCurrency_Float(float Value, TEnumAsByte<ERoundingMode> RoundingMode, bool bAlwaysSign = false, bool bUseGrouping = true, int32 MinimumIntegralDigits = 1, int32 MaximumIntegralDigits = 324, int32 MinimumFractionalDigits = 0, int32 MaximumFractionalDigits = 3, const FString& CurrencyCode = TEXT("")); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Value | float | The floating-point amount to format as currency. | — |
| RoundingMode | TEnumAsByte<ERoundingMode> | How fractional digits beyond the maximum should be rounded. | — |
| bAlwaysSign | bool | Whether to always show a sign (+/-), even for positive values. | false |
| bUseGrouping | bool | Whether to insert culture-appropriate thousands separators. | true |
| MinimumIntegralDigits | int32 | Minimum number of integer digits to display. | 1 |
| MaximumIntegralDigits | int32 | Maximum number of integer digits to display. | 324 |
| MinimumFractionalDigits | int32 | Minimum number of fractional digits to display. | 0 |
| MaximumFractionalDigits | int32 | Maximum number of fractional digits to display before rounding. | 3 |
| CurrencyCode | const FString& | ISO 4217 currency code to use for symbol/formatting rules. | TEXT("") |
Return Type
FText Example
Format a float price (legacy path) C++
FText PriceText = UKismetTextLibrary::AsCurrency_Float(6.5f, ERoundingMode::HalfToEven, false, true, 1, 324, 0, 2, TEXT("USD")); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?