IntExtensions
Static Class in Zigurous.Math
Declaration
public static class IntExtensions
Description
Extension methods for integers.
Extension Methods
GetBits | Returns a subset of bits from the number. |
HasFlag | Checks if a given flag is set in the bitmask. (mask & flag) == flag |
HasAnyFlag | Checks if any of the given flags are set in the bitmask. (mask & flags) != 0 |
IsEven | Checks if the number is even. n % 2 == 0 |
IsOdd | Checks if the number is odd. n % 2 != 0 |
IsZero | Checks if the number is zero. n == 0 |
IsPositive | Checks if the number is positive. n > 0 |
IsNegative | Checks if the number is negative. n < 0 |
NumDigits | Returns the number of digits in the number. |
ToAbbreviatedString | Converts the number to an abbreviated string, e.g. "1k" for 1000. |
ToBinaryString | Converts the number to a string of binary digits. |