Number Multiplier To Percent Method
2183 Views
-
| | | | --- | --- | | | # Converts a float multiplier to a percentage string. Author: VukeFN | | | # Example: 1.5 → "+50%", 2.0 → "+100%", 0.5 → "-50%" | | | ToPercentString<public>(Multiplier:float):string= | | | if(Percentage := Floor[(Multiplier - 1.0) * 100.0]): | | | if(Percentage >= 0): | | | "+{Percentage}%" | | | else: | | | "{Percentage}%" | | | else: | | | "+0%" |Converts a float multiplier to a percentage string. Author: VukeFN
Example: 1.5 → "+50%", 2.0 → "+100%", 0.5 → "-50%"
ToPercentString<public>(Multiplier:float):string= if(Percentage := Floor[(Multiplier - 1.0) * 100.0]): if(Percentage >= 0): "+{Percentage}%" else: "{Percentage}%" else: "+0%"
Copy full snippet(10 lines long)
Categories:
Purpose:
- Building Block
Recent tutorials
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.