📄 test_str.c
字号:
/* - - - - - - - - */
/* */
/* strcomma */
/* */
strcpy(work3, string2);
strcpy(work1, work3);
strcomma(work1);
printline("strcomma #1", work1, ans37);
strcpy(work1, work3);
*(work1+11) = ' ';
strcomma(work1);
printline("strcomma #2", work1, ans38);
strcpy(work1, work3);
*(work1+11) = ' ';
*(work1+10) = ' ';
strcomma(work1);
printline("strcomma #3", work1, ans39);
/* - - - - - - - - */
/* */
/* strcommaf */
/* */
strcpy(work1, string4);
strcommaf(work1);
printline("strcommaf #1", work1, "12,345.678");
strcpy(work1, string4);
printline("strcommaf #2", strcommaf(work1), "12,345.678");
/* - - - - - - - - */
/* */
/* strcommafnew */
/* */
strcpy(work1, string4);
strcommafnew(work2, work1);
printline("strcommafnew #1", work2, "12,345.678");
strcpy(work1, string4);
printline("strcommafnew #2", strcommafnew(work2, work1), "12,345.678");
/* - - - - - - - - */
/* */
/* strcommafri */
/* */
strcommafri(work1, 1234);
printline("strcommafri #1", work1, "1,234");
strcommafri(work1, -1234);
printline("strcommafri #2", work1, "-1,234");
printline("strcommafri #3", strcommafri(work1, 1234), "1,234");
/* - - - - - - - - */
/* */
/* strcommafrl */
/* */
strcommafrl(work1, 123456789L);
printline("strcommafrl #1", work1, ans37);
strcommafrl(work1, -123456789L);
printline("strcommafrl #2", work1, "-123,456,789");
printline("strcommafrl #3", strcommafrl(work1, 123456789L), ans37);
/* - - - - - - - - */
/* */
/* strcommafrui */
/* */
strcommafrui(work1, (unsigned)60000L);
printline("strcommafrui #1", work1, "60,000");
printline("strcommafrui #2", strcommafrui(work1, (unsigned)60000L), "60,000");
/* - - - - - - - - */
/* */
/* strcommafrul */
/* */
strcommafrul(work1, 4000000000L);
printline("strcommafrul #1", work1, "4,000,000,000");
printline("strcommafrul #2",
strcommafrul(work1, 4000000000L), "4,000,000,000");
/* - - - - - - - - */
/* */
/* strcomman */
/* */
strcpy(work1, string2);
strcomman(work1, 14);
printline("strcomman #1", work1, ans42);
strcpy(work1, string2);
printline("strcomman #2", strcomman(work1, 14), ans42);
/* - - - - - - - - */
/* */
/* strcommanew */
/* */
strcpy(work1, string2);
strcommanew(work2, work1);
printline("strcommanew #1", work2, ans37);
strcpy(work1, string2);
*(work1+11) = ' ';
strcommanew(work2, work1);
printline("strcommanew #2", work2, ans38);
strcpy(work1, string2);
*(work1+11) = ' ';
*(work1+10) = ' ';
strcommanew(work2, work1);
printline("strcommanew #3", work2, ans39);
strcpy(work1, string2);
printline("strcommanew #4", strcommanew(work2, work1), ans37);
/* - - - - - - - - */
/* */
/* strcommannew */
/* */
strcpy(work1, string2);
strcommannew(work2, work1, 14);
printline("strcommannew #1", work2, ans42);
strcpy(work1, string2);
printline("strcommannew #2", strcommannew(work2, work1, 14), ans42);
/* - - - - - - - - */
/* */
/* strcommatoi */
/* */
strcpy(work1, ans39 + 4);
itoa(strcommatoi(work1), work2, 10);
printline("strcommatoi #1", work2, "4567");
strcpy(work1, "-1,234");
itoa(strcommatoi(work1), work2, 10);
printline("strcommatoi #2", work2, "-1234");
/* - - - - - - - - */
/* */
/* strcommatol */
/* */
strcpy(work1, "2,000,000,000");
ltoa(strcommatol(work1), work2, 10);
printline("strcommatol #1", work2, "2000000000");
strcpy(work1, "-2,000,000,000");
ltoa(strcommatol(work1), work2, 10);
printline("strcommatol #2", work2, "-2000000000");
/* - - - - - - - - */
/* */
/* strcommatoui */
/* */
strcpy(work1, "60,000");
ltoa(strcommatoui(work1), work2, 10);
printline("strcommatoui", work2, "60000");
/* - - - - - - - - */
/* */
/* strcommatoul */
/* */
strcpy(work1, "4,000,000,000");
ultoa(strcommatoul(work1), work2, 10);
printline("strcommatoul", work2, "4000000000");
/* - - - - - - - - */
/* */
/* strdelwhite */
/* */
strcpy(work1, string1);
printline("strdelwhite", strdelwhite(work1), ans23);
/* - - - - - - - - */
/* */
/* strend */
/* */
printline("strend", strend(string1)-5, ans30);
/* - - - - - - - - */
/* */
/* streos */
/* */
strcpy(work1, string1);
printline("streos #1", streos(work1), work1);
for (ii = 0; ii < strlen(string1); ii++)
if (work1[ii] != EOS)
break;
if (ii == strlen(string1))
strcpy(work1, "good");
else
strcpy(work1, "bad");
printline("streos #2", work1, "good");
/* - - - - - - - - */
/* */
/* strfromc */
/* */
strcpy(work1, "a\\t\\142");
strfromc(work1);
printline("strfromc", work1, "a\tb");
/* - - - - - - - - */
/* */
/* strindex */
/* */
itoa(strindex(string1+15, string1), work1, 10);
printline("strindex", work1, "15");
/* - - - - - - - - */
/* */
/* strinsert */
/* */
strcpy(work1, string1 + 9);
printline("strinsert #1", strinsert(work1, 0, "time date"), string1);
strcpy(work1, string1);
strset(work1 + 10, '-');
work1[10] = EOS;
strinsert(work1, strlen(work1), "size other");
printline("strinsert #2", work1, string1);
/* - - - - - - - - */
/* */
/* strinsertnew */
/* */
strcpy(work1, string1 + 9);
printline("strinsertnew #1", strinsertnew(work2, work1, 0, "time date"), string1);
strcpy(work1, string1);
strset(work1 + 10, '-');
work1[10] = EOS;
strinsertnew(work2, work1, strlen(work2), "size other");
printline("strinsertnew #2", work2, string1);
/* - - - - - - - - */
/* */
/* strisempty */
/* */
work1[0] = EOS;
tempi = strisempty(work1);
printline("strisempty #1", itoa(tempi, work2, 10), "1");
work1[0] = '\n';
work1[1] = EOS;
tempi = strisempty(work1);
printline("strisempty #2", itoa(tempi, work2, 10), "1");
strcpy(work1, " ");
tempi = strisempty(work1);
printline("strisempty #3", itoa(tempi, work2, 10), "1");
tempi = strisempty(string1);
printline("strisempty #4", itoa(tempi, work2, 10), "0");
/* - - - - - - - - */
/* */
/* striswhite */
/* */
tempi = striswhite(" \t ");
printline("striswhite #1", itoa(tempi, work2, 10), "1");
tempi = striswhite("\n");
printline("striswhite #2", itoa(tempi, work2, 10), "0");
/* - - - - - - - - */
/* */
/* strleft */
/* */
strcpy(work1, string1);
strleft(work1, 9);
printline("strleft #1", work1, ans02);
strcpy(work1, string1);
strleft(work1, 99);
printline("strleft #2", work1, string1);
/* - - - - - - - - */
/* */
/* strleftnew */
/* */
strcpy(work2, "");
strleftnew(work2, string1, 9);
printline("strleftnew #1", work2, ans02);
strcpy(work2, "");
strleftnew(work2, string1, 99);
printline("strleftnew #2", work2, string1);
/* - - - - - - - - */
/* */
/* strlenmax */
/* */
tempi = strlenmax(string1, 50);
printline("strlenmax #1", itoa(tempi, work1, 10), "50");
tempi = strlenmax(string1, 10);
printline("strlenmax #2", itoa(tempi, work1, 10), "20");
/* - - - - - - - - */
/* */
/* strlenmin */
/* */
tempi = strlenmin(string1, 50);
printline("strlenmin #1", itoa(tempi, work1, 10), "20");
tempi = strlenmin(string1, 10);
printline("strlenmin #2", itoa(tempi, work1, 10), "10");
/* - - - - - - - - */
/* */
/* strlfdel */
/* */
strcpy(work1, string1);
strlfdel(work1, 10);
printline("strlfdel #1", work1, ans03);
strcpy(work1, string1);
strlfdel(work1, 99);
printline("strlfdel #2", work1, "");
strcpy(work1, string1);
printline("strlfdel #3", strlfdel(work1, 10), ans03);
/* - - - - - - - - */
/* */
/* strlfdelnew */
/* */
strcpy(work1, string1);
strlfdelnew(work2, work1, 10);
printline("strlfdelnew #1", work2, ans03);
strcpy(work1, string1);
strlfdelnew(work2, work1, 99);
printline("strlfdelnew #2", work2, "");
strcpy(work1, string1);
printline("strlfdelnew #3", strlfdelnew(work2, work1, 10), ans03);
/* - - - - - - - - */
/* */
/* strlfset */
/* */
strcpy(work1, string1);
strlfset(work1, 4, '-');
printline("strlfset #1", work1, ans19);
strcpy(work1, string1);
strlfset(work1, 99, '-');
printline("strlfset #2", work1, ans18);
strcpy(work1, string1);
printline("strlfset #3", strlfset(work1, 4, '-'), ans19);
/* - - - - - - - - */
/* */
/* strlfsetnew */
/* */
strlfsetnew(work1, string1, 4, '-');
printline("strlfsetnew #1", work1, ans19);
strlfsetnew(work1, string1, 99, '-');
printline("strlfsetnew #2", work1, ans18);
printline("strlfsetnew #3", strlfsetnew(work1, string1, 4, '-'), ans19);
/* - - - - - - - - */
/* */
/* strlfjust */
/* */
strcpy(work1, string2);
strlfjust(work1);
printline("strlfjust #1", work1, ans07);
strcpy(work1, string2);
printline("strlfjust #2", strlfjust(work1), ans07);
/* - - - - - - - - */
/* */
/* strlfjustnew */
/* */
strcpy(work2,"");
strlfjustnew(work2, string2);
printline("strlfjustnew #1", work2, ans07);
strcpy(work2,"");
printline("strlfjustnew #2", strlfjustnew(work2, string2), ans07);
/* - - - - - - - - */
/* */
/* strlfpad */
/* */
strtrimnew(work1, string2);
strlfpad(work1, 3, '-');
printline("strlfpad #1", work1, ans12);
strtrimnew(work1, string2);
printline("strlfpad #2", strlfpad(work1, 3, '-'), ans12);
/* - - - - - - - - */
/* */
/* strlfpadnew */
/* */
strtrimnew(work1, string2);
strlfpadnew(work2, work1, 3, '-');
printline("strlfpadnew #1", work2, ans12);
strtrimnew(work1, string2);
printline("strlfpadnew #2", strlfpadnew(work2, work1, 3, '-'), ans12);
/* - - - - - - - - */
/* */
/* strlfrot */
/* */
strcpy(work1, string1);
strlfrot(work1, 10);
printline("strlfrot #1", work1, ans08);
strcpy(work1, string1);
printline("strlfrot #2", strlfrot(work1, 10), ans08);
/* - - - - - - - - */
/* */
/* strlfrotnew */
/* */
strcpy(work1, string1);
strlfrotnew(work2, work1, 10);
printline("strlfrotnew #1", work2, ans08);
strcpy(work1, string1);
printline("strlfrotnew #2", strlfrotnew(work2, work1, 10), ans08);
/* - - - - - - - - */
/* */
/* strlfsh */
/* */
strcpy(work1, string1);
strlfsh(work1, 10);
printline("strlfsh #1", work1, ans05);
strcpy(work1, string1);
printline("strlfsh #2", strlfsh(work1, 10), ans05);
/* - - - - - - - - */
/* */
/* strlfshnew */
/* */
strcpy(work1, string1);
strlfshnew(work2, work1, 10);
printline("strlfshnew #1", work2, ans05);
strcpy(work1, string1);
printline("strlfshnew #2", strlfshnew(work2, work1, 10), ans05);
/* - - - - - - - - */
/* */
/* strlfsize */
/* */
strcpy(work1, string1);
strlfsize(work1, 10);
printline("strlfsize #1", work1, ans03);
strlfsize(work1, 20);
printline("strlfsize #2", work1, ans40);
strcpy(work1, string1);
printline("strlfsize #3", strlfsize(work1, 10), ans03);
/* - - - - - - - - */
/* */
/* strlfsizenew */
/* */
strlfsizenew(work1, string1, 10);
printline("strlfsizenew #1", work1, ans03);
strlfsizenew(work2, work1, 20);
printline("strlfsizenew #2", work2, ans40);
printline("strlfsizenew #3", strlfsizenew(work1, string1, 10), ans03);
/* - - - - - - - - */
/* */
/* strlftrim */
/* */
strcpy(work1, string2);
strlftrim(work1);
printline("strlftrim #1", work1, ans09);
strcpy(work1, string2);
printline("strlftrim #2", strlftrim(work1), ans09);
/* - - - - - - - - */
/* */
/* strlftrimnew */
/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -