changed the check for negative numbers
This commit is contained in:
		
							parent
							
								
									f0bc88b8ec
								
							
						
					
					
						commit
						d57bcf6958
					
				| @ -6,7 +6,7 @@ | ||||
| /*   By: achubuko <marvin@42.fr>                    +#+  +:+       +#+        */ | ||||
| /*                                                +#+#+#+#+#+   +#+           */ | ||||
| /*   Created: 2023/12/02 21:56:30 by achubuko          #+#    #+#             */ | ||||
| /*   Updated: 2023/12/03 18:07:15 by achubuko         ###   ########.fr       */ | ||||
| /*   Updated: 2023/12/03 18:14:54 by asargsya         ###   ########.fr       */ | ||||
| /*                                                                            */ | ||||
| /* ************************************************************************** */ | ||||
| #include "ft_utils.h" | ||||
| @ -33,13 +33,13 @@ int	ft_str_is_numeric(char *str) | ||||
| 	i = 0; | ||||
| 	if (str[i] == '\0') | ||||
| 		return (0); | ||||
| 	if (str[i] == '-') | ||||
| 		return (-1); | ||||
| 	while (str[i] != '\0') | ||||
| 	{ | ||||
| 		if (str[i] < '0' || str[i] > '9') | ||||
| 			return (0); | ||||
| 		i++; | ||||
| 	} | ||||
| 	if (str[0] == '-') | ||||
| 		return (-1); | ||||
| 	return (1); | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user