IntExtensions

final
class IntExtensions(val thisInt: Int) extends AnyVal

Extension methods for Int.

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def %%(divisor: Int): Int

More useful definition of modulus where a negative number divided by a positive divisor produces a non negative modulus.

More useful definition of modulus where a negative number divided by a positive divisor produces a non negative modulus.

@inline
def *(operator: Metres): Metres

Extension methods multiplies this scalar Int by the operand in metres

Extension methods multiplies this scalar Int by the operand in metres

def atLeast0: Int

Returns the value or 0, if this Int less than 0.

Returns the value or 0, if this Int less than 0.

def atMost0: Int

Returns the value or 0, if this Int more than 0.

Returns the value or 0, if this Int more than 0.

def base32: String

Base32 string representation of this Int.

Base32 string representation of this Int.

def billion: Long

multiplies this Int by a billion and returns the result as Long.

multiplies this Int by a billion and returns the result as Long.

def commaInts(otherInts: Int*): String
@inline
def degsToRadians: Double

Takes this Int as a value in arc degrees and converts it to a value of radians.

Takes this Int as a value in arc degrees and converts it to a value of radians.

@inline
def degsToSecs: Int

Takes this Int as a value in arc degrees and converts it to a value of arc seconds.

Takes this Int as a value in arc degrees and converts it to a value of arc seconds.

def diff(operand: Int): Int
def div2: Int

Divides this Int by 2.

Divides this Int by 2.

def div2RoundDown: Int
def div2RoundUp: Int
def div4: Int

Divides this Int by 4.

Divides this Int by 4.

def div4Rem0: Boolean

Dividing by 4 gives remainder of 0.

Dividing by 4 gives remainder of 0.

def div4Rem1: Boolean
def div4Rem2: Boolean

Dividing by 4 gives remainder of 2.

Dividing by 4 gives remainder of 2.

def div4Rem3: Boolean
def div8Rem2: Boolean
def div8Rem4: Boolean
def div8Rem6: Boolean
def divRoundUp(operand: Int): Int

Divides rounding up. 11.divRoundUp(10) == 2;

Divides rounding up. 11.divRoundUp(10) == 2;

def doTimes(f: () => Unit): Unit
def foldTo[A](toValue: Int, initialValue: A)(f: (A, Int) => A): A

folds across the Integer range starting with this Int to the given end of range.

folds across the Integer range starting with this Int to the given end of range.

def foldUntil[A](untilValue: Int, initialValue: A)(f: (A, Int) => A): A

folds across the Integer range starting with this Int until the given end of range.

folds across the Integer range starting with this Int until the given end of range.

@inline

Returns this Int value in GMetres or millions of kilometres.

Returns this Int value in GMetres or millions of kilometres.

@inline
def hexStr: String
@inline
def hexStr2: String
def hundredthsStr(hundreds: Int): String
def if0Else[A](vZero: => A, vNonZero: => A): A

Returns the first lazily evaluated parameter if this Int is 0 else returns the second lazily evaluated parameter.

Returns the first lazily evaluated parameter if this Int is 0 else returns the second lazily evaluated parameter.

def ifEvenElse[A](vEven: => A, vOdd: => A): A

Returns the first lazily evaluated parameter if this Int is even else returns the second lazily evaluated parameter.

Returns the first lazily evaluated parameter if this Int is even else returns the second lazily evaluated parameter.

@inline
def ifMod(predicate: Boolean, f: Int => Int): Int

if the predicate is true apply the function to this Int, else return thisInt unmodified.

if the predicate is true apply the function to this Int, else return thisInt unmodified.

def ifOddElse[A](vOdd: => A, vEven: => A): A

Returns the first lazily evaluated parameter if this Int is odd else returns the second lazily evaluated parameter.

Returns the first lazily evaluated parameter if this Int is odd else returns the second lazily evaluated parameter.

def ifSumEven[A](evenVal: => A, oddVal: => A, operand: Int): A
def ifSumOdd[A](oddVal: => A, evenVal: => A, operand: Int): A
def isDivBy3: Boolean
def isDivBy8: Boolean
def isEven: Boolean

Returns true if this Int is even, false if this Int is odd.

Returns true if this Int is even, false if this Int is odd.

def isOdd: Boolean

Returns true if this Int is even, false if this Int is odd.

Returns true if this Int is even, false if this Int is odd.

@inline

Returns this Int value in KMetres kilometres.

Returns this Int value in KMetres kilometres.

@inline

Returns this Int value in MMiles millions of miles.

Returns this Int value in MMiles millions of miles.

@inline

Returns this Int value in Metres.

Returns this Int value in Metres.

@inline

Returns this Int value in Miles.

Returns this Int value in Miles.

def million: Int

multiplies this Int by a million and returns the result as Int.

multiplies this Int by a million and returns the result as Int.

def power(operand: Int): Int

Only use positive value that won't overflow int)

Only use positive value that won't overflow int)

def quadrillion: Long

multiplies this Int by a quadrillion and returns the result as Long.

multiplies this Int by a quadrillion and returns the result as Long.

@inline
def radiansToDegs: Double

Takes this Int as a value in radians and converts it to a value of arc degrees.

Takes this Int as a value in radians and converts it to a value of arc degrees.

@inline
def radiansToSecs: Double

Takes this Int as a value in radians and converts it to a value of arc seconds.

Takes this Int as a value in radians and converts it to a value of arc seconds.

def repeatChar(c: Char): String
def roundDownTo(f: Int => Boolean): Int

Decrements the value of an integer while that integer does not match condition. Not guaranteed to terminate.

Decrements the value of an integer while that integer does not match condition. Not guaranteed to terminate.

Returns this Int's value if even, else returns thisInt - 1.

Returns this Int's value if even, else returns thisInt - 1.

Returns this Int's value if odd, else returns thisInt - 1.

Returns this Int's value if odd, else returns thisInt - 1.

def roundUpTo(f: Int => Boolean): Int

Increments the value of an integer while that integer does not match condition. Not guaranteed to terminate.

Increments the value of an integer while that integer does not match condition. Not guaranteed to terminate.

def roundUpToEven: Int

Returns this Int's value if even, else returns thisInt + 1.

Returns this Int's value if even, else returns thisInt + 1.

def roundUpToOdd: Int

Returns this Int's value if odd, else returns thisInt + 1.

Returns this Int's value if odd, else returns thisInt + 1.

@inline
def secsToDegs: Double

Takes this Int as a value in arc deconds and converts it to a value of arc degrees.

Takes this Int as a value in arc deconds and converts it to a value of arc degrees.

@inline
def secsToRadians: Double

Takes this Int as a value in arc seconds and converts it to a value of radians.

Takes this Int as a value in arc seconds and converts it to a value of radians.

def semicolonInts(otherInts: Int*): String
def spaces: String
def str2Dig: String
def tenthsStr(tenths: Int): String
def trillion: Long

multiplies this Int by a trillion and returns the result as Long.

multiplies this Int by a trillion and returns the result as Long.

Concrete fields

val thisInt: Int