text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_atoi.c                                          :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: smagdela <smagdela@student.42.fr>          +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2021/05/23 18:20:06 by smagdela          #+#    #+#             */
  /*   Updated: 2021/05/23 19:02:37 by smagdela         ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include "libft.h"
  
  int	ft_atoi(const char *str)
  {
  	int				sign;
  	int				i;
  	unsigned int	result;
  
  	i = 0;
  	sign = 1;
  	result = 0;
  	while (str[i] == 32 || (str[i] <= 13 && str[i] >= 9))
  		++i;
  	if (str[i] == 43 || str[i] == 45)
  	{
  		if (str[i] == 45)
  			sign *= -1;
  		++i;
  	}
  	while (ft_isdigit(str[i]))
  	{
  		result = (result * 10) + (str[i] - 48);
  		++i;
  	}
  	return (sign * result);
  }
  