IsInterval
''' <summary> ''' Determines if the Integer is of the specified interval. E.g. if the interval is 100 and the integer is 400, it would return true. ''' This function uses the Mod operator, for the above example: (300 Mod 100 = 0) ''' </summary> ''' <param name="num"></param> ''' <param name="interval"></param> ''' <returns></returns> ''' <remarks></remarks> <Extension()> _ Public Function IsInterval(ByVal num As Integer, ByVal interval As Integer) As Boolean If num Mod interval = 0 Then Return True Else Return False End If End FunctionExample:
Dim num As Integer = 200 If num.IsInterval(100) = True Then ' do something if fits the interval End IF
Description
Determines if the Integer is of the specified interval. E.g. if the interval is 100 and the integer is 400, it would return true. 127 would return false. This function uses the Mod operator, for the above example: (300 Mod 100 = 0)
Details
- Author: Blake Pell
- Submitted on: 7/7/2010 9:28:11 PM
- Language: VB
- Type: System.Integer
- Views: 1811
Double click on the code to select all.