numstring_conversions.c
long int _atoli(char *s)
{
	int a, c;
	long b, i;

/* start at the end of the string to find the ones' place */
	for (a = 0; s[a] != '\0';)
		a++;
	a--;
/* start a multiplier variable b, result variable i, and checker c */
	for (b = 1, i = 0, c = 0; a >= 0; a--)
	{
/* if we find a digit */
		if (s[a] <= '9' && s[a] >= '0')
		{
/* if it's a new digit after symbols were found, start counting from 0 again */
			if (c == 1 && (s[a + 1] < 48 || s[a + 1] > 57))
				i = 0, b = 1;
/* increase result i by the digit value * multiplier b */
			i += ((s[a] - 48) * b);
/* multiply b by 10 each time we move up a digit */
			b *= 10;
/* set checker flag to 1 when we first find a digit */
			c = 1;
		}
/* negative symbols change the sign of the result */
		if (s[a] == '-')
			i = -i;
	}
	return (i);
}
/**
 * _atoli - converts a string to a long integer
 * @s: string input
 * Return: integer value of string
 */
converts a string to a long integer
@s: string input
Return: integer value of string
converts a string to a long integer @s : string input Return : integer value of string
long int _atoli(char *s)
{
	int a, c;
	long b, i;
	for (a = 0; s[a] != '\0';)
		a++;
	a--;
	for (b = 1, i = 0, c = 0; a >= 0; a--)
	{
		if (s[a] <= '9' && s[a] >= '0')
		{
			if (c == 1 && (s[a + 1] < 48 || s[a + 1] > 57))
				i = 0, b = 1;
			i += ((s[a] - 48) * b);
			b *= 10;
			c = 1;
		}
		if (s[a] == '-')
			i = -i;
	}
	return (i);
}
long int _atoli ( char * s ) { int a , c ; long b , i ; for ( a = 0 ; s [ a ] != ' \0 ' ; ) a ++ ; a -- ; for ( b = 1 , i = 0 , c = 0 ; a >= 0 ; a -- ) { if ( s [ a ] <= ' ' && s [ a ] >= ' ' ) { if ( c == 1 && ( s [ a + 1 ] < 48 || s [ a + 1 ] > 57 ) ) i = 0 , b = 1 ; i += ( ( s [ a ] - 48 ) * b ) ; b *= 10 ; c = 1 ; } if ( s [ a ] == ' ' ) i = - i ; } return ( i ) ; }
_atoli - converts a string to a long integer
 @s: string input
 Return: integer value of string
_atoli - converts a string to a long integer @s : string input Return : integer value of string
/* start at the end of the string to find the ones' place */ /* start a multiplier variable b, result variable i, and checker c */ /* if we find a digit */ /* if it's a new digit after symbols were found, start counting from 0 again */ /* increase result i by the digit value * multiplier b */ /* multiply b by 10 each time we move up a digit */ /* set checker flag to 1 when we first find a digit */ /* negative symbols change the sign of the result */