Firetron’s FormatRoundedPercent

1 55 Views No Comments 4 weeks ago
  • Formats a number to be rounded and have the percent symbol.

    HaasScript Code
    --  ==========================================================================================================
    --    Firetron's FormatRoundedPercent
    --
    --    Formats a number to be rounded and have the percent symbol.
    --
    --    Discord:  @FiretronP75
    --    BTC Tips: 14WLDZsrhshcP6qvBarKW8ABACv3iUXEro
    --    ETH Tips: 0xfaaac99fbf11f8f4abc4b3bf079cb2c7a43b5f87
    --  ==========================================================================================================
    
    --  ==============
    --    Definition
    --  ==============
    
    DefineCommand('FormatRoundedPercent', 'Formats a number to be rounded and have the percent symbol.')
    
    --  ==============
    --    Parameters
    --  ==============
    
    local input  = DefineParameter(NumberType, 'Input',  'The number to format',   true,  0)
    local digits = DefineParameter(NumberType, 'Digits', 'The digits to round to', false, 2)
    local symbol = DefineParameter(StringType, 'Symbol', 'The symbol to append',   false, ' %')
    
    --  ==========
    --    Output
    --  ==========
    
    DefineOutput(StringType, Round(input, digits)..symbol, 'Formatted Value')
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free