char *ft_strtrim(const char *s) { char *strtrim; if (s) { strtrim = (char *)s; strtrim = ft_revstr(ft_rm_whitespace( ft_revstr(ft_rm_whitespace(strtrim)))); return (strtrim); } return (NULL); }
char *ft_utoa(uint32_t value, char *str, int base) { char *save; int i; if (base > 36 || base < 2 || !(save = str)) return (NULL); if (value == 0) *(str++) = '0'; i = 0; while (value != 0) { str[i++] = BASE_NBRS[value % base]; value /= base; } str[i] = '\0'; ft_revstr(str); return (save); }
char *ft_itoa_c(int value, char *str, int base) { char *save; int i; if (base > 36 || base < 2 || !(save = str)) return (NULL); if (value < 0) *(str++) = '-'; else if (value == 0) *(str++) = '0'; i = 0; while (value != 0) { str[i++] = BASE_NBRS[ABS(value) % base]; value /= base; } str[i] = '\0'; ft_revstr(str); return (save); }