BATCHLIB_ Batchlib library number.cmd
The batchlib library number.cmd is part of the batchlib package. It provides the following subroutines:
:IS_NUMBER: Checks if the first parameter is a number.
:NEAREST: Returns the nearest matching number from a sorted list of numbers.
:NEAREST_LESS: Returns the nearest matching number from a sorted list of numbers that is equal or less.
:NEAREST_GREATER: Returns the nearest matching number from a sorted list of numbers that is equal or greater.
:DEC2HEX: Converts a decimal number to hex.
Boolean :IS_NUMBER String
Checks if the first parameter is a number. That is it only contains the characters 0 to 9 and additionally the minus as the first character.
Parameters:
"true" if string is a valid number, "false" otherwise
Since: 1.0
Integer :NEAREST Integer[] Integer
Returns the nearest matching number from a sorted list of numbers.
Parameters:
nearest matching number of list
Since: 1.0
Integer :NEAREST_LESS Integer[] Integer
Returns the nearest matching number from a sorted list of numbers that is equal or less. If no such number can be found, the smallest from the list will be returned.
Parameters:
nearest matching number of list
Since: 1.0
Integer :NEAREST_GREATER Integer[] Integer
Returns the nearest matching number from a sorted list of numbers that is equal or greater. If no such number can be found, the greatest from the list will be returned.
Parameters:
nearest matching number of list
Since: 1.0
String :DEC2HEX Integer
Converts a decimal number to hex. Currently only numbers 0 <= x <= 255 are supported (0x00 <= x <= 0xFF). The result will NOT be prefixed with 0x!
Parameters:
hex representation of number
Since: 1.0
:IS_NUMBER: Checks if the first parameter is a number.
:NEAREST: Returns the nearest matching number from a sorted list of numbers.
:NEAREST_LESS: Returns the nearest matching number from a sorted list of numbers that is equal or less.
:NEAREST_GREATER: Returns the nearest matching number from a sorted list of numbers that is equal or greater.
:DEC2HEX: Converts a decimal number to hex.
Boolean :IS_NUMBER String
Checks if the first parameter is a number. That is it only contains the characters 0 to 9 and additionally the minus as the first character.
Parameters:
- string to test for number
"true" if string is a valid number, "false" otherwise
Since: 1.0
Integer :NEAREST Integer[] Integer
Returns the nearest matching number from a sorted list of numbers.
Parameters:
- list of integers sorted ascending
- number to match
nearest matching number of list
Since: 1.0
Integer :NEAREST_LESS Integer[] Integer
Returns the nearest matching number from a sorted list of numbers that is equal or less. If no such number can be found, the smallest from the list will be returned.
Parameters:
- list of integers sorted ascending
- number to match
nearest matching number of list
Since: 1.0
Integer :NEAREST_GREATER Integer[] Integer
Returns the nearest matching number from a sorted list of numbers that is equal or greater. If no such number can be found, the greatest from the list will be returned.
Parameters:
- list of integers sorted ascending
- number to match
nearest matching number of list
Since: 1.0
String :DEC2HEX Integer
Converts a decimal number to hex. Currently only numbers 0 <= x <= 255 are supported (0x00 <= x <= 0xFF). The result will NOT be prefixed with 0x!
Parameters:
- decimal number 0 <= x <= 255
hex representation of number
Since: 1.0
cypressor - 28. Mär, 21:18