I have a method that gets two endpoints of a range - the beginning of the range and the end of the range and an integer.
It checks to see if an integer falls between two endpoints and returns either an integer or the corresponding endpoint if the integer is out of bounds.
Example 1:
- RangeStart = 0; RangeEnd = 10; Value = 5; Returns 5
Example 2:
- RangeStart = 0; RangeEnd = 10; Value = -4; Returns 0
Example 3:
- RangeStart = 0; RangeEnd = 10; Value = 23; Returns 10
Question: What should I call the method that does this? I called it IntWithinRange, but I don't think I like it.
Any ideas?
source
share