<commit_before>/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strctrim.c                                      :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: kdavis <<EMAIL>>                      +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2016/10/14 12:13:30 by kdavis            #+#    #+#             */
/*   Updated: 2016/10/17 09:19:35 by kdavis           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft.h"

/*
**	Trims char c from the front and back of str.
*/

char	*ft_strctrim(char *str, char c)
{
	int		i;
	int		len;
	char	*res;

	i = 0;
	len = 0;
	while (*str == c)
		str++;
	while (str[i])
		i++;
	i--;
	while (str[i] == c && i >= 0)
		i--;
	if (!(res = ft_strsub(str, 0, i + 1)))
		return (NULL);
	return (res);
}<commit_msg>remove unused variable from ft_strctrim<commit_after>/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_strctrim.c                                      :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: kdavis <<EMAIL>>                      +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2016/10/14 12:13:30 by kdavis            #+#    #+#             */
/*   Updated: 2017/04/29 13:02:08 by kdavis           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libft.h"

/*
**	Trims char c from the front and back of str.
*/

char	*ft_strctrim(char *str, char c)
{
	int		i;
	char	*res;

	i = 0;
	while (*str == c)
		str++;
	while (str[i])
		i++;
	i--;
	while (str[i] == c && i >= 0)
		i--;
	if (!(res = ft_strsub(str, 0, i + 1)))
		return (NULL);
	return (res);
}
{'fraction_non_alphanumeric': 0.28291316526610644, 'fraction_numerical': 0.026010404161664665, 'mean_word_length': 0.9364833462432223, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '197971', 'n_tokens_mistral': 757, 'n_tokens_neox': 668, 'n_words': 134}