IntExtensions

ostrat.IntExtensions
final class IntExtensions(val thisInt: Int) extends AnyVal

Extension methods for Int.

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

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.

Attributes

def *(operator: Length): Length

Extension methods multiplies this scalar Int by the operand in metres

Extension methods multiplies this scalar Int by the operand in metres

Attributes

def base32: String

Base32 string representation of this Int.

Base32 string representation of this Int.

Attributes

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.

Attributes

def commaInts(otherInts: Int*): String

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.

Attributes

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.

Attributes

def diff(operand: Int): Int

The absolute difference between this Int and the operand Int.

The absolute difference between this Int and the operand Int.

Attributes

def div2: Int

Divides this Int by 2.

Divides this Int by 2.

Attributes

def div4: Int

Divides this Int by 4.

Divides this Int by 4.

Attributes

Dividing by 4 gives remainder of 0.

Dividing by 4 gives remainder of 0.

Attributes

Dividing this Int by 4 == 1

Dividing this Int by 4 == 1

Attributes

Dividing by 4 gives remainder of 2.

Dividing by 4 gives remainder of 2.

Attributes

def divRoundUp(operand: Int): Int

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

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

Attributes

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.

Attributes

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.

Attributes

def frenchOrdAbbr(masculine: Boolean): String

French Ordinal abbreviated form. "1er" / "1re", "2e", "3e", "4e", etc.

French Ordinal abbreviated form. "1er" / "1re", "2e", "3e", "4e", etc.

Attributes

Returns this Int value in Length or millions of kilometres.

Returns this Int value in Length or millions of kilometres.

Attributes

def hexStr: 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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

Returns this Int value in Length kilometres.

Returns this Int value in Length kilometres.

Attributes

def mMiles: Length

Returns this Int value in Length millions of miles.

Returns this Int value in Length millions of miles.

Attributes

def max0: Int

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

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

Attributes

def metres: Length

Returns this Int value in Length.

Returns this Int value in Length.

Attributes

def miles: Length

Returns this Int value in Length.

Returns this Int value in Length.

Attributes

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.

Attributes

def min0: Int

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

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

Attributes

Ordinal abbreviated form. "1st", "2nd", "3rd", "4th", etc.

Ordinal abbreviated form. "1st", "2nd", "3rd", "4th", etc.

Attributes

def power(operand: Int): Int

Only use positive value that won't overflow int)

Only use positive value that won't overflow int)

Attributes

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

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

Attributes

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.

Attributes

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.

Attributes

Returns a String in which a Char is repeated the given parameter number of times.

Returns a String in which a Char is repeated the given parameter number of times.

Attributes

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.

Attributes

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

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

Attributes

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

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

Attributes

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.

Attributes

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

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

Attributes

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

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

Attributes

def scaledStr(pairs: (Int, String)*): String
def scaledStr(i1: Int, s1: String, i2: Int, s2: String, i3: Int, s3: String, pairs: (Int, String)*): String

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.

Attributes

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.

Attributes

def semicolonInts(otherInts: Int*): String
def spaces: String

Returns a String of of the given number of space characters.

Returns a String of of the given number of space characters.

Attributes

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.

Attributes

Concrete fields

val thisInt: Int