Extension methods for integer values.
Static variables
Static methods
staticcanParse(s:String):Bool
canParse takes a string and return a boolean indicating if the argument can be safely transformed
into a valid integer value.
staticinlineclampSym(v:Int, max:Int):Int
Like clamp but you only pass one argument (max) that is used as the upper limit
and the opposite (additive inverse or -max) as the lower limit.
staticcompare(a:Int, b:Int):Int
Return a comparison value between a and b. The number is negative if a is
greater than b, positive if a is lesser than b or zero if a and b are
equals.
staticinterpolate(f:Float, a:Float, b:Float):Int
Given a value t between 0 and 1, it interpolates that value in the range between a and b.
The returned value is a rounded integer.
staticparse(s:String, ?base:Int):Null<Int>
Parses a string into an Int value using the provided base. Default base is 16 for strings that begin with 0x (after optional sign) or 10 otherwise.
staticinlinerandom(min:Int = 0, max:Int):Int
Integer random function that includes both upper and lower limits. A roll on a die with 6 sides would be the equivalent to the following:
var d6 = Ints.random(1, 6);staticrange(start:Int, ?stop:Int, step:Int = 1):Array<Int>
range creates an array of integer containing values between start (included) and stop (excluded)
with a progression set by step. A negative value for step can be used but in that
case start will need to be a greater value than stop.
staticinlinetoBase(value:Int, base:Int):String
Alias for toString, mainly for disambig. with standard toString using mega Thx. Should toString just be renamed to this? At least with this, existing code doesn't break.
staticinlinetoBool(v:Int):Bool
Converts an integer value into a boolean. Any value different from 0 will evaluate to true.
staticinlinetoInt(s:String, ?base:Int):Int
Alias for parse, mainly for disambiguation with other parses using mega Thx.