mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-21 15:09:32 +02:00
fix: containsOnlyDigits (remove minus)
This commit is contained in:
@@ -41,8 +41,8 @@ export function reverseString(input: string): string {
|
|||||||
/**
|
/**
|
||||||
* Checks if the input string contains only digits.
|
* Checks if the input string contains only digits.
|
||||||
* @param input - The string to validate.
|
* @param input - The string to validate.
|
||||||
* @returns True if the input contains only digits, false otherwise.
|
* @returns True if the input contains only digits including float, false otherwise.
|
||||||
*/
|
*/
|
||||||
export function containsOnlyDigits(input: string): boolean {
|
export function containsOnlyDigits(input: string): boolean {
|
||||||
return /^-?\d+(\.\d+)?$/.test(input.trim());
|
return /^\d+(\.\d+)?$/.test(input.trim());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user