⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_str.c

📁 String Manipulation Routines
💻 C
📖 第 1 页 / 共 5 页
字号:
strcpy(work1, string2);
strlftrimnew(work2, work1);
printline("strlftrimnew #1", work2, ans09);

strcpy(work1, string2);
printline("strlftrimnew #2", strlftrimnew(work2, work1), ans09);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmid								*/
/*									*/
strcpy(work1, string1);
strmid(work1, 5);
printline("strmid #1", work1, ans01);

strcpy(work1, string1);
strmid(work1, 55);
printline("strmid #2", work1, "");

strcpy(work1, string1);
printline("strmid #3", strmid(work1, 5), ans01);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmiddel							*/
/*									*/
strcpy(work1, string1);
strmiddel(work1, 5, 5);
printline("strmiddel #1", work1, ans22);

strcpy(work1, string1);
strmiddel(work1, 9, 99);
printline("strmiddel #2", work1, ans02);

strcpy(work1, string1);
strmiddel(work1, 99, 5);
printline("strmiddel #3", work1, string1);

strcpy(work1, string1);
printline("strmiddel #4", strmiddel(work1, 5, 5), ans22);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmiddelnew							*/
/*									*/
strmiddelnew(work1, string1, 5, 5);
printline("strmiddelnew #1", work1, ans22);

strmiddelnew(work1, string1, 9, 99);
printline("strmiddelnew #2", work1, ans02);

strmiddelnew(work1, string1, 99, 5);
printline("strmiddelnew #3", work1, string1);

printline("strmiddelnew #4", strmiddelnew(work1, string1, 5, 5), ans22);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidset							*/
/*									*/
strcpy(work1, string1);
strmidset(work1, 4, 6, '-');
printline("strmidset #1", work1, ans26);

strcpy(work1, string1);
printline("strmidset #2", strmidset(work1, 4, 6, '-'), ans26);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidsetnew							*/
/*									*/
strcpy(work1, string1);
strmidsetnew(work2, work1, 4, 6, '-');
printline("strmidsetnew #1", work2, ans26);

strcpy(work1, string1);
printline("strmidsetnew #2", strmidsetnew(work2, work1, 4, 6, '-'), ans26);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidn								*/
/*									*/
strcpy(work1, string1);
strmidn(work1, 5, 4);
printline("strmidn #1", work1, "date");

strcpy(work1, string1);
printline("strmidn #2", strmidn(work1, 5, 4), "date");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidnew							*/
/*									*/
strmidnew(work2, string1, 5);
printline("strmidnew #1", work2, ans01);

strmidnew(work2, string1, 55);
printline("strmidnew #2", work2, "");

printline("strmidnew #3", strmidnew(work2, string1, 5), ans01);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidnnew							*/
/*									*/
strcpy(work1, string1);
strmidnnew(work2,work1, 5, 4);
printline("strmidnnew #1", work2, "date");

strcpy(work1, string1);
printline("strmidnnew #2", strmidnnew(work2, work1, 5, 4), "date");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidpad							*/
/*									*/
strcpy(work1, string1);
strmiddel(work1, 4, 6);
strmidpad(work1, 4, 3, '-');
printline("strmidpad #1", work1, ans32);

strcpy(work1, string1);
strmiddel(work1, 4, 6);
printline("strmidpad #2", strmidpad(work1, 4, 3, '-'), ans32);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strmidpadnew							*/
/*									*/
strcpy(work1, string1);
strmiddel(work1, 4, 6);
strmidpadnew(work2, work1, 4, 3, '-');
printline("strmidpadnew #1", work2, ans32);

strcpy(work1, string1);
strmiddel(work1, 4, 6);
printline("strmidpadnew #2", strmidpadnew(work2, work1, 4, 3, '-'), ans32);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrepeat							*/
/*									*/
strrepeat(work1, "this ", 3);
printline("strrepeat", work1, "this this this ");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrepeatn							*/
/*									*/
strrepeatn(work1, "this is ", 6, 20);
printline("strrepeat", work1, "this is this is this");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strreverse							*/
/*									*/
strcpy(work1, string1);
strreverse(work1);
printline("strreverse #1", work1, ans25);

strcpy(work1, string1);
printline("strreverse #2", strreverse(work1), ans25);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strreversenew							*/
/*									*/
strreversenew(work1, string1);
printline("strreversenew #1", work1, ans25);

printline("strreversenew #1", strreversenew(work1, string1), ans25);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strright							*/
/*									*/
strcpy(work1, string1);
strright(work1, 10);
printline("strright #1", work1, ans03);

strcpy(work1, string1);
strright(work1, 99);
printline("strright #2", work1, string1);

strcpy(work1, string1);
printline("strright #3", strright(work1, 10), ans03);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrightnew							*/
/*									*/
strcpy(work2,"");
strrightnew(work2, string1, 10);
printline("strrightnew #1", work2, ans03);

strcpy(work2,"");
strrightnew(work2, string1, 99);
printline("strrightnew #2", work2, string1);

strcpy(work2,"");
printline("strrightnew #3", strrightnew(work2, string1, 10), ans03);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtdel							*/
/*									*/
strcpy(work1, string1);
strrtdel(work1, 11);
printline("strrtdel #1", work1, ans02);

strcpy(work1, string1);
strrtdel(work1, 99);
printline("strrtdel #2", work1, "");

strcpy(work1, string1);
printline("strrtdel #3", strrtdel(work1, 11), ans02);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtdelnew							*/
/*									*/
strcpy(work1, string1);
strrtdelnew(work2, work1, 11);
printline("strrtdelnew #1", work2, ans02);

strcpy(work1, string1);
strrtdelnew(work2, work1, 99);
printline("strrtdelnew #2", work2, "");

strcpy(work1, string1);
printline("strrtdelnew #3", strrtdelnew(work2, work1, 11), ans02);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtset							*/
/*									*/
strcpy(work1, string1);
strrtset(work1, 5, '-');
printline("strrtset #1", work1, ans20);

strcpy(work1, string1);
strrtset(work1, 99, '-');
printline("strrtset #2", work1, ans18);

strcpy(work1, string1);
printline("strrtset #3", strrtset(work1, 5, '-'), ans20);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtsetnew							*/
/*									*/
strrtsetnew(work1, string1, 5, '-');
printline("strrtsetnew #1", work1, ans20);

strrtsetnew(work1, string1, 99, '-');
printline("strrtsetnew #2", work1, ans18);

printline("strrtsetnew #3", strrtsetnew(work1, string1, 5, '-'), ans20);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtjust							*/
/*									*/
strcpy(work1, string2);
strrtjust(work1);
printline("strrtjust #1", work1, ans06);

strcpy(work1, string2);
printline("strrtjust #2", strrtjust(work1), ans06);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtjustnew							*/
/*									*/
strcpy(work2, "");
strrtjustnew(work2, string2);
printline("strrtjustnew #1", work2, ans06);

strcpy(work2, "");
printline("strrtjustnew #2", strrtjustnew(work2, string2), ans06);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtpad							*/
/*									*/
strtrimnew(work1, string2);
strrtpad(work1, 3, '-');
printline("strrtpad #1", work1, ans13);

strtrimnew(work1, string2);
printline("strrtpad #2", strrtpad(work1, 3, '-'), ans13);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtpadnew							*/
/*									*/
strtrimnew(work1, string2);
strrtpadnew(work2, work1, 3, '-');
printline("strrtpadnew #1", work2, ans13);

strtrimnew(work1, string2);
printline("strrtpadnew #2", strrtpadnew(work2, work1, 3, '-'), ans13);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtrot							*/
/*									*/
strcpy(work1, string1);
strrtrot(work1, 10);
printline("strrtrot #1", work1, ans08);

strcpy(work1, string1);
printline("strrtrot #2", strrtrot(work1, 10), ans08);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtrotnew							*/
/*									*/
strcpy(work1, string1);
strrtrotnew(work2, work1, 10);
printline("strrtrotnew #1", work2, ans08);

strcpy(work1, string1);
printline("strrtrotnew #2", strrtrotnew(work2, work1, 10), ans08);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtsh								*/
/*									*/
strcpy(work1, string1);
strrtsh(work1, 11);
printline("strrtsh #1", work1, ans04);

strcpy(work1, string1);
printline("strrtsh #2", strrtsh(work1, 11), ans04);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtshnew							*/
/*									*/
strcpy(work1, string1);
strrtshnew(work2, work1, 11);
printline("strrtshnew #1", work2, ans04);

strcpy(work1, string1);
printline("strrtshnew #2", strrtshnew(work2, work1, 11), ans04);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtsize							*/
/*									*/
strcpy(work1, string1);
strrtsize(work1, 9);
printline("strrtsize #1", work1, ans02);

strrtsize(work1, 20);
printline("strrtsize #2", work1, ans41);

strcpy(work1, string1);
printline("strrtsize #3", strrtsize(work1, 9), ans02);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrtsizenew							*/
/*									*/
strrtsizenew(work1, string1, 9);
printline("strrtsizenew #1", work1, ans02);

strrtsizenew(work2, work1, 20);
printline("strrtsizenew #2", work2, ans41);

printline("strrtsizenew #1", strrtsizenew(work1, string1, 9), ans02);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrttrim							*/
/*									*/
strcpy(work1, string2);
strrttrim(work1);
printline("strrttrim #1", work1, ans10);

strcpy(work1, string2);
printline("strrttrim #2", strrttrim(work1), ans10);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strrttrimnew							*/
/*									*/
strcpy(work1, string2);
strrttrimnew(work2, work1);
printline("strrttrimnew #1", work2, ans10);

strcpy(work1, string2);
printline("strrttrimnew #2", strrttrimnew(work2, work1), ans10);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strstri								*/
/*									*/
/*	char *strstri(char *instring,  char *substring);		*/
/*									*/
/*	<== not done yet <==	*/

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubcount							*/
/*									*/
itoa(strsubcount("This that and the other", "th"), work1, 10);
printline("strsubcount #1", work1, "3");

itoa(strsubcount("This that and the other", "This that and the other thing"), work1, 10);
printline("strsubcount #2", work1, "0");


/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubcounti							*/
/*									*/
itoa(strsubcounti("This that and the other", "TH"), work1, 10);
printline("strsubcounti #1", work1, "4");

itoa(strsubcounti("This that", "THis that and"), work1, 10);
printline("strsubcounti #2", work1, "0");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdel							*/
/*									*/
strcpy(work1, string1);
strsubdel(work1, "time date ");
printline("strsubdel #1", work1, ans03);

strcpy(work1, string1);
printline("strsubdel #2", strsubdel(work1, "time date "), ans03);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdelall							*/
/*									*/
strcpy(work1, "This that and the other");
strsubdelall(work1, "th");
printline("strsubdelall #1", work1, "This at and e oer");

strcpy(work1, "This that and the other");
printline("strsubdelall #2", strsubdelall(work1, "th"), "This at and e oer");

printline("strsubdelall #3", strsubdelall("this", "this and that"), "this");
/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdelallnew							*/
/*									*/
/* <== next mod goes here <==	*/
strcpy(work1, "This that and the other");
strsubdelallnew(work2, work1, "th");
printline("strsubdelallnew #1", work2, "This at and e oer");

strcpy(work1, "This that and the other");
printline("strsubdelallnew #2", strsubdelallnew(work2, work1, "th"),
					"This at and e oer");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdeli							*/
/*									*/
strcpy(work1, "This that and the other");
strsubdeli(work1, "th");
printline("strsubdeli #1", work1, "is that and the other");

strcpy(work1, "This that and the other");
printline("strsubdeli #2", strsubdeli(work1, "th"), "is that and the other");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdeliall							*/
/*									*/
strcpy(work1, "This that and the other");
strsubdeliall(work1, "TH");
printline("strsubdelall #1", work1, "is at and e oer");

strcpy(work1, "This that and the other");
printline("strsubdelall #2", strsubdeliall(work1, "TH"), "is at and e oer");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdeliallnew						*/
/*									*/
strcpy(work1, "This that and the other");
strsubdeliallnew(work2, work1, "TH");
printline("strsubdeliallnew #1", work2, "is at and e oer");

strcpy(work1, "This that and the other");
printline("strsubdeliallnew #2", strsubdeliallnew(work2, work1, "TH"),
						"is at and e oer");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strsubdelinew							*/
/*									*/
strcpy(work1, "This that and the other");
strsubdelinew(work2, work1, "th");
printline("strsubdelinew #1", work2, "is that and the other");

strcpy(work

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -