fix: containsOnlyDigits (remove minus)

This commit is contained in:
Chesterkxng
2025-03-26 17:39:51 +00:00
parent 674c587bd0
commit 890005f77c

View File

@@ -41,8 +41,8 @@ export function reverseString(input: string): string {
/**
* Checks if the input string contains only digits.
* @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 {
return /^-?\d+(\.\d+)?$/.test(input.trim());
return /^\d+(\.\d+)?$/.test(input.trim());
}