char *ft_strcapitalize(char *str) { int i; i = 0; ft_strlowcase(str); if (str[0] >= 'a' && str[0] <= 'z') { str[0] -= 32; i++; } while (str && str[i]) { if (str[i] >= '0' && str[i] <= '9') if (str[i + 1] >= 'a' && str[i + 1] <= 'z') i++; if (!(str[i] >= 'a' && str[i] <= 'z')) if (str[i + 1] >= 'a' && str[i + 1] <= 'z') { str[i + 1] -= 32; i++; } i++; } return (str); }
int main(int argc, char **argv) { char str[1000]; int i; int j; int k; i = 1; while (i < argc) { j = 0; k = 0; while (argv[i][j]) { if (argv[i][j] != ' ') { str[k] = argv[i][j]; k++; } j++; } str[j] = '\0'; ft_strlowcase(str); ft_is_present(str); i++; } return (0); }
int main(void) { char str1[] = "Salut les gars Connent ))0as3223412334@$!@#$#@ $3241`123 '0 OOO ooo !"; printf("Original: %s ", str1); printf("Final: %s ", ft_strlowcase(str1)); return (0); }
int main(void) { char s[] = "ABCDEFG"; char *lows; lows = ft_strlowcase(s); ft_putstr(lows); return (0); }
int main(void) { char c; char **tab; c = 0; tab[0] = "frecfgrdfgdQREEQRV33423423"; tab[1] = "0"; ft_putstr(ft_strlowcase(tab[0])); return 0; }
int main(void) { time_t start_t, end_t; double diff_t; char *data[TEST_CASES]; char *str; char your_result[300]; char actual_result[300]; char master_test[300]; int i; ft_add_test_case(&data[0], "Je Code avec le CUL"); ft_add_test_case(&data[1], "U MAD BRO"); ft_add_test_case(&data[2], ""); ft_add_test_case(&data[3], "iBI^7toBO&*TYUIbb7"); ft_add_test_case(&data[4], master_test); i = 21; while (i < 255) { master_test[i-21] = i; ++i; } master_test[i-21] = '\0'; i = 0; while (i < TEST_CASES) { ft_get_values(&data[i], &str); strcpy(your_result, str); strcpy(actual_result, str); time(&start_t); ft_strlowcase(your_result); time(&end_t); strlowcase(actual_result); diff_t = difftime(end_t, start_t); printf("str: %s, your_result: %s, actual_result: %s, execution time = %f\n", str, your_result, actual_result, diff_t); if (strcmp(your_result,actual_result) != 0) FAKE_N_GAY; if (diff_t >= 2.0) SNAIL; ++i; } GOES; }
char *ft_strcapitalize(char *str) { int i; str = ft_strlowcase(str); i = 1; if (str[0] >= 'a' && str[0] <= 'z') str[0] -= 32; while (str[i] != '\0') { if ((str[i] < '0' || str[i] > '9') && (!(str[i] >= 'A' && str[i] <= 'Z')) && (str[i] < 'a' || str[i] > 'z')) { if (str[i + 1] >= 'a' && str[i + 1] <= 'z') str[i + 1] -= 32; } i++; } return (str); }
int main(int argc, char **argv) { int i; argc = 0; argv[1] = ft_strlowcase(argv[1]); i = 1; if (argv[1][0] >= 'a' && argv[1][0] <= 'z') argv[1][0] -= 32; while (argv[1][i] != '\0') { if ((argv[1][i] < '0' || argv[1][i] > '9') && (!(argv[1][i] >= 'A' && argv[1][i] <= 'Z')) && (argv[1][i] < 'a' || argv[1][i] > 'z')) { if (argv[1][i + 1] >= 'a' && argv[1][i + 1] <= 'z') argv[1][i + 1] -= 32; } i++; } ft_putstr(argv[1]); write(1, "\n", 1); return (0); }
int main() { char str[] = "Hello, I'm 22 years old"; ft_putstr(ft_strlowcase(str)); return (0); }