IntScrewdriver<T> extension

Provides extensions for int.

on

Properties

asBool bool
Returns true for non-zero values just like C language. e.g 1.asBool // returns true 0.asBool // returns false 452.asBool // returns true
no setter
days Duration
Returns Duration equal to this no. of days
no setter
daysAfter DateTime
Returns DateTime with date that is this days after
no setter
daysAgo DateTime
Returns DateTime with date that is this days ago
no setter
digits List<int>
Returns list of digits of this e.g 12345.digits // returns 1, 2, 3, 4, 5 e.g 8564.digits // returns 8, 5, 6, 4
no setter
hours Duration
Returns Duration equal to this no. of hours
no setter
hoursAfter DateTime
Returns DateTime with time that is this hours after
no setter
hoursAgo DateTime
Returns DateTime with time that is this hours ago
no setter
isLeapYear bool
Returns true if this represents a leap year
no setter
length int
Returns no. of digits e.g. 3.length // returns 1 21.length // returns 2 541.length // returns 3
no setter
microseconds Duration
Returns Duration equal to this no. of microseconds
no setter
milliseconds Duration
Returns Duration equal to this no. of milliseconds
no setter
minutes Duration
Returns Duration equal to this no. of minutes
no setter
minutesAfter DateTime
Returns DateTime with time that is this minutes after
no setter
minutesAgo DateTime
Returns DateTime with time that is this minutes ago
no setter
seconds Duration
Returns Duration equal to this no. of seconds
no setter
weeks Duration
Returns Duration equal to this no. of weeks
no setter
weeksAfter DateTime
Returns DateTime with date that is this weeks after
no setter
weeksAgo DateTime
Returns DateTime with date that is this weeks ago
no setter

Methods

downTo(int end) IntRange
Creates an IntRange starting from this to end inclusively with default step size of 1. Example: 5.downTo(1); // creates range 5-4-3-2-1
isDivisibleBy(int divider) bool
Returns true if this can be completely divisible by divider
isDivisibleByAll(List<int> dividers) bool
Returns true if this can be completely divisible by all of the dividers.
rangeTo(int end) IntRange
Creates an IntRange starting from this to end inclusively with default step size of 1. Example: 5.rangeTo(10); // creates range 5-6-7-8-9-10
repeat(T func(int count)) List<T>
runs func for this number of times. This is irrespective of the sign of this. the for loop will always run from 1 to absolute value of this.
twoDigits() String
Returns int as string which has a zero appended as prefix if this is a single digit value.
until(int end) IntRange
Returns a range from this value up to but excluding the specified end value.