int ft_lowups(char *s1, char *s2) { int i; i = 0; while (s1[i] || s2[i]) { if (s1[i] != s2[i]) { if (!ft_isalpha(s1[i]) || !ft_isalpha(s2[i])) return (ft_strcmp(s1, s2)); else if (ft_isalpha(s1[i]) && ft_isalpha(s2[i])) { if (ft_islower(s1[i]) && ft_islower(s2[i])) return (ft_strcmp(s1, s2)); else if (ft_isupper(s1[i]) && ft_isupper(s2[i])) return (ft_strcmp(s1, s2)); else return (ft_diff_cases(s1, s2, i)); } } i++; } return (0); }
int ft_unload_hex(t_print *gl, char *str, unsigned long long int x, char t) { if (!ft_isupper(t)) str = ft_itoa_base(x, 16); else str = ft_itoa_base_maj(x, 16); gl->space = ft_strlen(str); ft_putstr(gl->s); if (gl->p < 0) { if (gl->hash == 2 && gl->c == '0') { gl->hash = 0; ft_putchar('0'); gl->space++; if (!ft_isupper(t)) ft_putchar('x'); else ft_putchar('X'); gl->space++; } unload_hex3(gl, str, x, t); } if (gl->p >= 0) ft_unload_hex2(gl, str, x, t); return (gl->space + gl->i + ft_strlen(gl->s)); }
void check_isupper() { int i = 0; printf( "--------\nTest ft_isupper:\n" ); for ( i = MIN; i < MAX; i++ ) { if ( ft_isupper( i ) != isupper( i ) ) { printf("[%d] -> result: %c, expected result: %c\n", i, ft_isupper( i ), isupper( i ) ); exit( 0 ); } } printf("\033[32mOk\n\033[0m"); }
int check_spec(const char *format, int *i, t_arg *sarg) { if (ft_strlen(sarg->spec) == 0 && ft_strchr(SPEC, ft_tolower(format[*i]))) { sarg->spec[0] = format[*i]; sarg->spec[1] = '\0'; sarg->action = define_action(SPEC, format[*i]); if (ft_isupper(format[*i]) && format[*i] != 'X') { reini_mod(sarg); sarg->spec[0] = ft_tolower(format[*i]); sarg->action = define_action(SPEC, sarg->spec[0]); } else if (format[*i] == 'p') sarg->mod.j = 1; return (1); } if (format[*i] == 'i') { sarg->spec[0] = 'd'; sarg->action = define_action(SPEC, 'd'); return (1); } return (0); }
int ft_tolower(int c) { if (ft_isupper(c)) return (c + 32); else return (c); }
/* Given a PostScript font name, create the Macintosh LWFN file name. */ static void create_lwfn_name( char* ps_name, Str255 lwfn_file_name ) { int max = 5, count = 0; FT_Byte* p = lwfn_file_name; FT_Byte* q = (FT_Byte*)ps_name; lwfn_file_name[0] = 0; while ( *q ) { if ( ft_isupper( *q ) ) { if ( count ) max = 3; count = 0; } if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) ) { *++p = *q; lwfn_file_name[0]++; count++; } q++; } }
int ft_printf_ldtoa(t_ldbl val, int prec, char *buff, char spe) { t_uldbl dbl; int expn; int base; char *bstr; dbl.val = val; bstr = BASE_DENARY; if (spe == 'a' || spe == 'A') bstr = spe == 'A' ? BASE_HEXA_UP : BASE_HEXA; base = (int)ft_strlen(bstr); if (dbl.bits.expn == 2047) { ft_strcat(buff, dbl.bits.mant ? "nan" : "\0"); if (!dbl.bits.mant) ft_strcat(buff, dbl.bits.sign ? "-inf" : "inf"); buff = ft_isupper(spe) ? ft_strtoupper(buff) : buff; return (0); } buff[0] = dbl.bits.sign ? '-' : buff[0]; dbl.bits.sign = 0; expn = getint(&dbl, &prec, buff + 1, spe); dbl.val *= base; dtoa_base(&dbl.val, buff + 1, prec, bstr); buff = !buff[0] ? ft_strcpy(buff, buff + 1) : buff; return (expn); }
int ft_unload_hex3(t_print *gl, char *str, unsigned long long int x, char t) { if (x == 0) { ft_putstr(gl->s); while (gl->p-- != 0) { ft_putchar('0'); gl->larg--; gl->i++; if (gl->p < 0) break ; } while (gl->larg-- > 0 && gl->i++ < 2147483647) ft_putchar(' '); return (gl->i + ft_strlen(gl->s)); } if (!ft_isupper(t)) str = ft_itoa_base(x, 16); else str = ft_itoa_base_maj(x, 16); gl->space = ft_strlen(str); ft_putstr(gl->s); return (unload_hex(gl, str, x, t)); }
int ft_isalpha(int c) { int n; n = ft_islower(c) + ft_isupper(c); return (n); }
static int ft_parse_printf_char2(t_printf_parse_env *env, va_list args) { if (**env->fmt == 'p' || **env->fmt == 'P') ft_printf_do_pointer(env, args, ft_isupper(**env->fmt)); else if (**env->fmt == 'i' || **env->fmt == 'd') ft_printf_do_int(env, args); else if (**env->fmt == 'o' || **env->fmt == 'O') ft_printf_do_number(env, args, 8, ft_isupper(**env->fmt)); else if (**env->fmt == 'x' || **env->fmt == 'X') ft_printf_do_number(env, args, 16, ft_isupper(**env->fmt)); else if (**env->fmt == 'u' || **env->fmt == 'U') ft_printf_do_number(env, args, 10, ft_isupper(**env->fmt)); else return (0); return (1); }
int ft_isalpha(int c) { if (ft_isupper(c) || ft_islower(c)) return (1); else return (0); }
void ft_vsnprintf_handle_pointer(t_vsnprintf_env *env, va_list args) { ft_strncpy(env->offset, "0x", env->max); env->offset += 2; env->counter += 2; ft_vsnprintf_hexa(env, args, ft_isupper(*env->format), 1); }
void place_pattern(char *tab, char **tryresult, int i, int j) { int h; int l; int m; h = 0; l = 0; m = 0; while (ft_isupper(tab[h]) == 0) h++; while (tab[h + l] != '\0') { if (tab[h + l] == '\n') m++; if (ft_isupper(tab[h + l]) == 1) tryresult[i + m][j + l - (m * 5)] = tab[h + l]; l++; } }
char *ft_strlowcase(char *str) { int i; i = 0; while (str[i]) { if (ft_isupper(str[i])) str[i] += 32; i++; } return (str); }
void test_isupper(void) { int i, test[1024], ctrl[1024]; print_test_name("------------ISUPPER------------"); i = 0; while (i < 1024) { ctrl[i] = isupper(i); test[i] = ft_isupper(i); ++i; } test_hard(); print_test_results_summary(test, ctrl, 1024); printf("\n"); }
char *ft_rotn(char *str, int n) { int i; i = 0; while (str[i]) { if (ft_islower(str[i])) str[i] = (str[i] - 'a' + n) % 26 + 'a'; else if (ft_isupper(str[i])) str[i] = (str[i] - 'A' + n) % 26 + 'A'; else str[i] = str[i]; ++i; } return (str); }
unsigned short ft_get_type(char c) { unsigned short type; type = ft_isupper(c) ? UPPER : 0; c = ft_tolower(c); type |= (c == 'd' || c == 'i') ? INT_V : 0; type |= (c == 'b') ? U_MOD + BIN_V : 0; type |= (c == 'o') ? U_MOD + OCT_V : 0; type |= (c == 'u') ? U_MOD + INT_V : 0; type |= (c == 'x') ? U_MOD + HEX_V : 0; type |= (c == 'c') ? CHARV : 0; type |= (c == 's') ? STR_V : 0; type |= (c == 'n') ? SZE_V : 0; type |= (c == 'p') ? PTR_V : 0; return (type); }
void ft_unload_hex2(t_print *gl, char *str, unsigned long long int x, char t) { while (gl->larg > (gl->space + gl->hash) && gl->i < 2147483647 && gl->larg > gl->p) { gl->i++; ft_putchar(' '); gl->larg--; } if (gl->hash == 2) { gl->hash = 0; ft_putchar('0'); gl->space++; if (!ft_isupper(t)) ft_putchar('x'); else ft_putchar('X'); gl->space++; } unload_hex2(gl, x, str); }
int ft_toupper(int c) { if (ft_isalpha(c) && !ft_isupper(c)) return (c - 32); return (c); }
int ft_isalpha(int c) { if (ft_isupper(c) == 1 || ft_islower(c) == 1) return (1); return (0); }
int ft_tolower(int c) { if (ft_isupper(c) == 1) c = c + 32; return (c); }
int ft_tolower(int c) { if (ft_isupper(c)) return (c + 'a' - 'A'); return (c); }
int ft_tolower(int c) { return (ft_isupper(c) ? c + 32 : c); }
int ft_tolower(int c) { if (ft_isupper(c)) c += 32; return (c); }
int ft_isalpha(int c) { return (ft_islower(c) || ft_isupper(c)); }
int ft_tolower(int c) { if (ft_isupper(c)) return (c + 0x020); return (c); }
void ft_vsnprintf_handle_bool(t_vsnprintf_env *env, va_list args) { ft_vsnprintf_bool(env, args, ft_isupper(*env->format)); }
int ft_toupper(int c) { if (ft_isupper(c)) return (c - 32); return (c); }
int ft_isalpha(int c) { return (ft_isupper(c) == 1 || ft_islower(c) == 1); }
int ft_tolower(int c) { if (ft_isalpha(c) && ft_isupper(c)) c = c + 32; return (c); }