suve

awful: function: perc

Declaration

string :perc ( int $VAL, int $MAX )
string :perc ( float $VAL, float $MAX )
string :perc ( float $VAL )

Summary

Returns a string expressing one value as percentage of another - if VAL is equal to MAX, returns 100%. When passed a single float, expresses it as percentage (1.0 being 100%).

Example

# :perc example.
:set &U :sysinfo-disk-used
:set &T :sysinfo-disk-total
:writeln s'Disk usage: ' :perc $U $T

wikistrona zmodyfikowana 2014/0601/2317