int ft_atoi_base(char *str, int base) { int nb; int cpt; int sign; nb = 0; cpt = 0; sign = 1; while (str[cpt] == '\n' || str[cpt] == '\t' || str[cpt] == '\v' || str[cpt] == '\r' || str[cpt] == '\f' || str[cpt] == ' ') cpt++; if (str[cpt] == '-') { sign = -1; cpt++; } else if (str[cpt] == '+') cpt++; while (str[cpt] != '\0' && ft_isnummax(ft_toupper(str[cpt]), base) != 0) { nb *= base; nb += ft_base_change(ft_toupper(str[cpt])); cpt++; } return (nb * sign); }
static int getint(t_uldbl *dbl, int *prec, char *buff, char spe) { int expn; int intpart_size; char *bstr; bstr = spe == 'A' ? BASE_HEXA_UP : BASE_HEXA; bstr = ft_toupper(spe) == 'A' ? bstr : BASE_DENARY; expn = ft_toupper(spe) == 'F' ? 1 : adjust(&(dbl->val), spe); if ((spe == 'G' || spe == 'g') || (spe == 'a' || spe == 'A')) { if (ft_toupper(spe != 65) && expn > -4 && ((*prec >= 0 && expn < *prec) || (*prec < 0 && expn < 6)) && expn != 0 && ft_toupper(spe) != 65) intpart_size = dtoa_base(&dbl->val, buff, expn + 1, bstr); else intpart_size = dtoa_base(&dbl->val, buff, 1, bstr); *prec -= (spe == 'G' || spe == 'g' ? intpart_size : 0); } else ft_printf_lltoa_base(buff + 1, BASE_DENARY, (int64_t)dbl->val); if (ft_strchr("EF", ft_toupper(spe))) { ft_strcpy(buff, buff + 2); buff[ft_strlen(buff) + 1] = '\0'; } ft_ccat(buff, *prec ? '.' : '\0'); return (expn); }
int ft_atoi_base(const char *str, int basenb) { int result; int i; int is_neg; static const char *base = "0123456789ABCDEF"; char *sub; result = 0; i = 0; while (str[i] == ' ' || str[i] == '\n' || str[i] == '\t' || str[i] == '\v' || str[i] == '\f' || str[i] == '\r') i++; is_neg = (str[i] == '-') ? -1 : 1; i += (str[i] == '+' || str[i] == '-'); sub = ft_strsub(base, 0, basenb); while (str[i] && ft_strchr(sub, ft_toupper(str[i]))) { result = result * basenb; result = result + (ft_strchr(sub, ft_toupper(str[i])) - sub); i++; } free(sub); result = result * is_neg; return (result); }
int count_links(t_info *info, int x, int y) { int t_x; int t_y; int links; t_y = -1; links = 0; while (++t_y < info->token.y) { t_x = 0; while (t_x < info->token.x && x < info->board.x && y < info->board.y) { if (info->token.map[t_y][t_x] == '*' && ft_toupper(info->board.map[y][x]) == info->player) links++; if (ft_toupper(info->board.map[y][x] == info->p2 && info->token.map[t_y][t_x] == '*')) return (2); t_x++; x++; } x -= t_x; y++; } return (links); }
int main() { char t1[2]; int fd = open("main.c", O_RDONLY); char buf[9]; ft_bzero(buf, 9); ft_strcat(buf, "Ba"); ft_strcat(buf, "j"); ft_strcat(buf, "our."); printf("%s\n", buf); t1[0] = '1'; t1[1] = '\0'; printf("bzero test : %s\n", t1); printf("strlen test : %zu\n", ft_strlen("asd")); printf("strcat test : %s\n", ft_strcat(t1, "ab")); printf("isalpha test : yes %d no %d yes %d no %d\n", ft_isalpha('z'), ft_isalpha('`'), ft_isalpha('A'), ft_isalpha(125)); printf("isdigit test : yes %d no %d yes %d no %d\n", ft_isdigit('1'), ft_isdigit('/'), ft_isdigit('9'), ft_isdigit(':')); printf("isalnum test : yes %d no %d\n", ft_isalnum('1'), ft_isalnum('~')); printf("isascii test : yes %d no %d yes %d no %d\n", ft_isascii('\0'), ft_isascii(-12), ft_isascii(127), ft_isascii(200)); printf("isprint test : yes %d no %d\n", ft_isprint(32), ft_isprint(127)); printf("tolower test : A %c Z %c a %c ~ %c\n", ft_tolower('A'), ft_tolower('Z'), ft_tolower('a'), ft_tolower('~')); printf("toupper test : a %c z %c A %c ~ %c\n", ft_toupper('a'), ft_toupper('z'), ft_toupper('A'), ft_toupper('~')); ft_puts("Hello World"); ft_puts("aaa\n(null)\n"); ft_puts("aaa"); ft_puts(NULL); ft_cat(fd); return (0); }
void ft_printf_print(t_ptf *ptf, char *prfx, char *input, int n) { char *width; ft_printf_dump_fmt(ptf); width = " "; if (ft_strchr(ptf->flags, '0')) width = ptf->precision < 0 || ft_strchr("rsScC", ptf->spec) ? "0" : " "; if (ft_strlen(prfx) && *width == '0') ft_printf_buff_cat(ptf, prfx, (uint64_t)ft_strlen(prfx)); if (!ft_strchr(ptf->flags, '-') && ptf->width > 0) ft_printf_buff_catn(ptf, width, (uint64_t)ptf->width); if (ft_strlen(prfx) && *width == ' ') ft_printf_buff_cat(ptf, prfx, (uint64_t)ft_strlen(prfx)); if (ft_strchr("BDIOUXP", ft_toupper(ptf->spec)) && ptf->precision > 0) ft_printf_buff_catn(ptf, "0", (uint64_t)ptf->precision); if (ptf->spec == 'S') ft_printf_print_wcs(ptf, (wchar_t*)input, n); else if (ptf->spec == 'r') ft_printf_buff_cat_npr(ptf, input, (uint64_t)n); else if (ptf->spec != 'S') ft_printf_buff_cat(ptf, input, (uint64_t)n); if (ft_strchr("AEF", ft_toupper(ptf->spec)) && ptf->precision > 0) ft_printf_buff_catn(ptf, "0", (uint64_t)ptf->precision); if (ft_strchr(ptf->flags, '-') && (int)ptf->width > 0) ft_printf_buff_catn(ptf, " ", (uint64_t)ptf->width); }
int main(int ac, char **av) { int i; int n; if (ac == 1) return 1; else { i = 1; n = 0; while (i < ac) { while (av[i][n] != '\0') { if (toupper(av[i][n]) == ft_toupper(av[i][n])) n++; else { printf("%i:%i=%i\n", av[i][n], toupper(av[i][n]), ft_toupper(av[i][n])); return 2; } } i++; } } return 0; }
static void ft_check_toupper(void) { int i; i = -1; while (++i < 128) printf("Value: %d, Ret: %d, char: %c, toupper: %c\n", i, ft_toupper(i), i, ft_toupper(i)); }
void check_toupper() { int i = 0; printf( "--------\nTest ft_toupper:\n" ); for ( i = MIN; i < MAX; i++ ) { if ( ft_toupper( i ) != toupper( i ) ) { printf("[%d] -> result: %c, expected result: %c\n", i, ft_toupper( i ), toupper( i ) ); exit( 0 ); } } printf("\033[32mOk\n\033[0m"); }
int main() { char c; c='m'; printf("%c",ft_toupper(c)); c='D'; printf("\n%c",ft_toupper(c)); c='9'; printf("\n%c",ft_toupper(c)); c='|'; printf("\n%c", ft_toupper(c)); return (0); }
t_cli handle_type(t_env env, t_cli cli, char *str) { char **args; (void)env; args = ft_strsplit2(str, ' '); if (ft_toupper(args[1][0]) == 'A' || ft_toupper(args[1][0] == 'I')) { cli.type_transfer = ft_toupper(args[1][0]); S_MESSAGE(200, cli.fd); } else E_MESSAGE(504, cli.fd); free(args); return (cli); }
int ft_printf_hexm(unsigned int n) { if (n >= 16) return (ft_printf_hexm(n / 16) + ft_printf_hexm(n % 16)); else return (ft_printf_char(ft_toupper(HEX[n]))); }
char get_type_64(struct nlist_64 *sym, t_slice *sections) { if (sym->n_type & N_EXT) { if ((sym->n_type & N_TYPE) == N_SECT) return (ft_toupper(get_section_type_64(sym->n_sect, sections))); if ((sym->n_type & N_TYPE) == N_UNDF) return (sym->n_value ? 'C' : 'U'); if ((sym->n_type & N_TYPE) == N_ABS) return ('A'); if ((sym->n_type & N_TYPE) == N_INDR) return ('I'); return (' '); } else { if ((sym->n_type & N_TYPE) == N_SECT) return (get_section_type_64(sym->n_sect, sections)); if ((sym->n_type & N_TYPE) == N_UNDF) return ('u'); if ((sym->n_type & N_TYPE) == N_ABS) return ('a'); if ((sym->n_type & N_TYPE) == N_INDR) return ('i'); return (' '); } }
static int adjust(t_ldbl *val, char spe) { int i; int base; i = 0; base = ft_toupper(spe) == 'A' ? 2 : 10; if (*val > (base - 1) || *val < 1) { while ((int)*val > (base - 1) || (int)*val < 1) { if (*val > (base - 1)) { *val /= base; i++; } else { *val *= base; i--; } if (i < -200) return (0); } } return (i); }
char *ft_capitalize(char *s) { if (s != NULL) if (ft_isalpha(s[0]) && s[0] >= 97 && s[0] <= 122) s[0] = ft_toupper(s[0]); return (s); }
void ft_strtoupper(char *str) { while (str && *str) { *str = (char)ft_toupper((int)(*str)); str++; } }
void ft_strtoupper(char *string) { while (*string) { *string = ft_toupper(*string); string++; } }
void ft_strtoupper(char *str) { while (*str) { *str = ft_toupper(*str); str++; } }
char *ft_toupperstr(char *s) { int i; i = -1; while (s[++i]) s[i] = ft_toupper(s[i]); return (s); }
int ft_strupper(char *str) { while (*str) { *str = ft_toupper(*str); str++; } return (1); }
char *ft_strcapitalize(char *s) { int i; i = 1; if (s) { ft_strtodowncase(s); s[0] = ft_toupper(s[0]); while (s[i]) { if (ft_iswhitespace(s[i - 1])) s[i] = ft_toupper(s[i]); else s[i] = ft_tolower(s[i]); i++; } } return (s); }
char *ft_str_toupper(char *str) { int i = 0; while (str && str[i]) { str[i] = ft_toupper(str[i]); i++; } return (str); }
char *ft_strtoupper(char *s) { int i; i = -1; if (!s) return (0); while (s[++i]) s[i] = ft_toupper(s[i]); return (s); }
char *ft_strupper(char *const s) { char *cp; cp = (char *)s; while (*cp) { *cp = ft_toupper(*cp); cp++; } return (s); }
char *ft_strtoupper(char *str) { int c; c = 0; while (str[c] != '\0') { str[c] = ft_toupper(str[c]); c++; } return (str); }
char *ft_strtoupper(char *s) { char *start; start = s; while (s && *s) { *s = ft_toupper(*s); s++; } return (start); }
static int up_var(char *str, int start, int length) { int j; j = start; while (str[j] && j < length + start) { str[j] = ft_toupper(str[j]); j++; } return (0); }
char *ft_strtoupper(char *s) { int i; i = 0; while (s[i] != '\0') { s[i] = ft_toupper(s[i]); i++; } return (s); }
int main() { int i = 0; char str[] = "change the case\n"; while(str[i]) { ft_putchar (ft_toupper(str[i])); i++; } return (0); }
char *ft_strupper(char *str) { int i; i = 0; while (str[i]) { str[i] = ft_toupper((int)str[i]); i++; } return (str); }