Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Humanizer Decimal

Siticone Humanizer Decimal

The SiticoneHumanizerDecimal is a specialized utility component designed to transform raw numeric values into concise, human-readable formats. Instead of displaying raw numbers like "1,200,000" or "5,678,901,234", it converts them into compact strings like "1.2M" or "5.67B". This component is essential for dashboards, financial reports, and analytic tools where screen space is premium and readability is paramount.

Core Data

Properties and accessors for managing the numeric input and retrieving the formatted output.

Property Type Description & Usage Example
Value decimal humanizer.Value = 1500000m; The raw decimal number to be processed. Setting this updates the Humanized property immediately.
Humanized string lblStats.Text = humanizer.Humanized; Read-Only. Returns the formatted string representation of the current Value using default settings (e.g., "1.5M").
HumanizedValue string string output = humanizer.HumanizedValue; Read-Only. An alias for the Humanized property, providing the same human-readable string output.

Formatting Methods

Advanced methods for customizing the output format at runtime.

GetHumanizedValue Method
// Overload 1: Default formatting (2 decimal places, InvariantCulture)
string result = humanizer.GetHumanizedValue();

// Overload 2: Custom decimal places and culture
string custom = humanizer.GetHumanizedValue(
    decimalPlaces: 1, 
    culture: new CultureInfo("fr-FR")
);
Use GetHumanizedValue when you need on-the-fly formatting with specific precision or localization requirements without changing the global state of the component.

Supported Suffixes

The component automatically applies the following suffixes based on the magnitude of the Value.

Suffix Name Threshold
(none) Standard < 1,000
K Thousand ≥ 1,000 (10³)
M Million ≥ 1,000,000 (10⁶)
B Billion ≥ 1,000,000,000 (10⁹)
T Trillion ≥ 1,000,000,000,000 (10¹²)
Q Quadrillion ≥ 10¹⁵
Qa Quintillion ≥ 10¹⁸

Designer & Smart Tags

The SiticoneHumanizerDecimal includes a robust Visual Studio Designer integration, offering quick access to testing and configuration tools.

Feature Category Capabilities
Value Presets Instantly set the Value to common test cases:
  • Zero / Small: Test basic formatting.
  • Thousand (K) / Million (M): Test standard suffixes.
  • Billion (B) / Trillion (T): Test large number handling.
  • Negative: Verify negative number formatting.
Format Options View Current Format: Displays a popup with the current humanized string.
Preview All Formats: Opens a dialog showing the current value formatted with 0-4 decimal places.
Select Culture: Preview how the number looks in different locales (e.g., "1.2k" vs "1,2k").
Actions Copy Humanized Value: Copies the resulting string (e.g., "1.5M") to the clipboard.
Copy/Paste Settings: Transfer the Value property between different component instances.

Detailed Usage Examples

Example 1: Social Media Stats

Formatting follower counts and view metrics for a dashboard.

C# - Dashboard Stats
private void UpdateSocialStats(decimal views, decimal likes)
{
                // Configure for views (e.g., 1.5M)
    humanizerViews.Value = views;
    lblViews.Text = humanizerViews.GetHumanizedValue(1) + " Views";

                // Configure for likes (e.g., 250.4K)
    humanizerLikes.Value = likes;
    lblLikes.Text = humanizerLikes.GetHumanizedValue(1) + " Likes";
}

// Usage
UpdateSocialStats(1542000, 250420); 
// Output: "1.5M Views", "250.4K Likes"

Example 2: Financial Reporting

Displaying revenue figures with high precision and currency context.

C# - Financial Data
private void DisplayRevenue(decimal revenue)
{
    humanizerDecimal.Value = revenue;
    
                // Use 3 decimal places for precision in financial reports
                string formatted = humanizerDecimal.GetHumanizedValue(3);
    
    lblRevenue.Text = $"Total Revenue: ${formatted}";
}

// Usage
DisplayRevenue(1250750000.50m);
// Output: "Total Revenue: $1.250B"

Example 3: Localization Support

Formatting numbers for different regions using the culture parameter.

C# - Localization
private void ShowLocalizedValues()
{
    humanizerDecimal.Value = 1500.5m;

                // US English (Dot separator)
                var usCulture = new CultureInfo("en-US");
                Console.WriteLine(humanizerDecimal.GetHumanizedValue(2, usCulture)); 
                // Output: "1.50K"

                // German (Comma separator)
                var deCulture = new CultureInfo("de-DE");
                Console.WriteLine(humanizerDecimal.GetHumanizedValue(2, deCulture)); 
                // Output: "1,50K"
}