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

📄 test_str.c

📁 String Manipulation Routines
💻 C
📖 第 1 页 / 共 5 页
字号:
/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnotchri							*/
/*									*/
printline("ptrprevnotchri #1", ptrprevnotchri(strend(string1), 'R'), "er");

printline("ptrprevnotchri #2", ptrprevnotchri(strend(ans21), 'r'), "ER");

/*printline("ptrprevnotchri #3", ptrprevnotchri(string1 + 6, 'A'), ans01);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnotdig							*/
/*									*/
printline("ptrprevnotdig #1", ptrprevnotdig(strend(ans12)), ans12 + 2);

printline("ptrprevnotdig #2", ptrprevnotdig(strend(string1)), "r");

printline("ptrprevnotdig #3", 1 + ptrprevnotdig(string2 + 9), ans09);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnotrange							*/
/*									*/
printline("ptrprevnotrange #1",
		ptrprevnotrange(strend(ans27), ' ', '?'), ans27 + 3);

printline("ptrprevnotrange #2",
		ptrprevnotrange(string1 + 9, 'a', 'z'), string1 + 4);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnotgr							*/
/*									*/
printline("ptrprevnotgr",
		ptrprevnotgr(ans37 + 7, "0123456789"), ans37 + 3);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnottextterm						*/
/*									*/
printline("ptrprevnottextterm",
		ptrprevnottextterm(11 + "this:,. \t!,"), "s:,. \t!,");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevnotwhite							*/
/*									*/
printline("ptrfirstnotwhite", ptrfirstnotwhite(string2), ans09);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevrange							*/
/*									*/
printline("ptrprevrange #1", ptrprevrange(strend(string2), '0', '9'), string2 + 11);

printline("ptrprevrange #2", ptrprevrange(string4 + 9, '0', '9'), string4 + 7);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevgr							*/
/*									*/
printline("ptrprevgr #1", ptrprevgr(strend(string2), "0123456789"), string2 + 11);

printline("ptrprevgr #2", ptrprevgr(string1, ""), NULL);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevsub							*/
/*									*/
printline("ptrprevsub #1", ptrprevsub(strend(string6), "sub1"), string6 + 16);

printline("ptrprevsub #2", ptrprevsub(strend(string1), "size"), ans03);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevsubi							*/
/*									*/
printline("ptrprevsubi #1", ptrprevsubi(strend(string6), "SUB1"), string6 + 16);

printline("ptrprevsubi #2", ptrprevsubi(strend(ans21), "size"), ans21 + 10);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevtext							*/
/*									*/
printline("ptrprevtext", ptrprevtext(string2 + 16), string2 + 3);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevtextterm							*/
/*									*/
printline("ptrprevtextterm", ptrprevtextterm(string7 + 11), string7 + 5);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevwhite							*/
/*									*/
printline("ptrprevwhite #1", ptrprevwhite(strend(string1)), string1 + 9);

strcpy(work1, "abc\tother");

printline("ptrprevwhite #2", 1 + ptrprevwhite(strend(work1)), ans30);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrprevword							*/
/*									*/
printline("ptrprevword #1", ptrprevword(strend(string1)), ans30);

printline("ptrprevword #2", ptrprevword(strend(string1) - 1), string1 + 10);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrthistext							*/
/*									*/
printline("ptrthistext #1", ptrthistext(string7 + 10), string7 + 6);

printline("ptrthistext #2", ptrthistext(" "), NULL);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	ptrthisword							*/
/*									*/
printline("ptrthisword #1", ptrthisword(string1 + 12), ans03);

printline("ptrthisword #2", ptrthisword(string1 + 10), ans03);

printline("ptrthisword #3", ptrthisword(string1 + 9), NULL);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strblank							*/
/*									*/
strcpy(work1, ans30);
strblank(work1);
printline("strblank #1", work1, "     ");

strcpy(work1, ans30);
printline("strblank #2", strblank(work1), "     ");


/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strblanktotab							*/
/*									*/
strcpy(work1, "This is         the     sample line");
strblanktotab(work1, 8);
printline("strblanktotab #1", work1, "This is\t\tthe\tsample line");

strcpy(work1, "This is     the     sample line");
strblanktotab(work1, 4);
printline("strblanktotab #2", work1, "This is\t\tthe\t\tsample line");

strcpy(work1, "This is         the     sample line");
printline("strblanktotab #1", strblanktotab(work1, 8),
			"This is\t\tthe\tsample line");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcenter							*/
/*									*/
strcpy(work1, string2);
*(work1+11) = ' ';
strcenter(work1);
printline("strcenter #2", work1, ans15);

strcpy(work1, string2);
*(strend(work1)-1) = '\0';
strcenter(work1);
printline("strcenter #3", work1, ans16);

strcpy(work1, string2);
*(work1+11) = ' ';
*(strend(work1)-1) = '\0';
strcenter(work1);
printline("strcenter #4", work1, ans17);

strcpy(work1, string2);
printline("strcenter #5", strcenter(work1), ans14);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcentern							*/
/*									*/
strcpy(work1, string2);
strcentern(work1, 12);
printline("strcentern #1", work1, ans33);

strcpy(work1, string2);
strcentern(work1, 13);
printline("strcentern #2", work1, ans34);

strcpy(work1, string2);
*(work1+11) = ' ';
strcentern(work1, 12);
printline("strcentern #3", work1, ans35);

strcpy(work1, string2);
*(work1+11) = ' ';
strcentern(work1, 13);
printline("strcentern #4", work1, ans36);

strcpy(work1, string2);
printline("strcentern #5", strcentern(work1, 12), ans33);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcenternew							*/
/*									*/
strcpy(work1, string2);
strcenternew(work2, work1);
printline("strcenternew #1", work2, ans14);

strcpy(work1, string2);
*(work1+11) = ' ';
strcenternew(work2, work1);
printline("strcenternew #2", work2, ans15);

strcpy(work1, string2);
*(work1+strlen(work1)-1) = '\0';
strcenternew(work2, work1);
printline("strcenternew #3", work2, ans16);

strcpy(work1, string2);
*(work1+11) = ' ';
*(work1+strlen(work1)-1) = '\0';
strcenternew(work2, work1);
printline("strcenternew #4", work2, ans17);

strcpy(work1, string2);
printline("strcenternew #5", strcenternew(work2, work1), ans14);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcenternnew							*/
/*									*/
strcenternnew(work1, string2, 12);
printline("strcenternnew #1", work1, ans33);

strcenternnew(work1, string2, 13);
printline("strcenternnew #2", work1, ans34);

strcpy(work1, string2);
*(work1+11) = ' ';
strcenternnew(work2, work1, 12);
printline("strcenternnew #3", work2, ans35);

strcpy(work1, string2);
*(work1+11) = ' ';
strcenternnew(work2, work1, 13);
printline("strcenternnew #4", work2, ans36);

printline("strcenternnew #5", strcenternnew(work1, string2, 12), ans33);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchecksuma							*/
/*									*/
/*	unsigned long  strchecksuma(char *instring);			*/
/*									*/
/*	<== not done yet <==	*/

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchecksumia							*/
/*									*/
/*	unsigned long  strchecksumia(char *instring);			*/
/*									*/
/*	<== not done yet <==	*/

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchecksumil							*/
/*									*/
/*	unsigned char  strchecksumil(char *instring);			*/
/*									*/
/*	<== not done yet <==	*/

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchecksuml							*/
/*									*/
/*	unsigned char  strchecksuml(char *instring);			*/
/*									*/
/*	<== not done yet <==	*/

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrcount							*/
/*									*/
itoa(strchrcount(string3, 's'), work1, 10);
printline("strchrcount #1", work1, "1");

itoa(strchrcount(string1, '-'), work1, 10);
printline("strchrcount #2", work1, "0");

itoa(strchrcount(ans18, '-'), work1, 10);
printline("strchrcount #3", work1, "20");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrcounti							*/
/*									*/
itoa(strchrcounti(string3, 's'), work1, 10);
printline("strchrcounti #1", work1, "3");

itoa(strchrcounti(string1, '-'), work1, 10);
printline("strchrcounti #2", work1, "0");

itoa(strchrcounti(ans18, '-'), work1, 10);
printline("strchrcounti #3", work1, "20");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdel							*/
/*									*/
strcpy(work1, string1);
strchrdel(work1, ' ');
printline("strchrdel #1", work1, ans23);

strcpy(work1, string1);
printline("strchrdel #2", strchrdel(work1, ' '), ans23);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdeli							*/
/*									*/

strcpy(work1, string3);
strchrdeli(work1, 's');
printline("strchrdeli #1", work1, ans43);

strcpy(work1, string3);
printline("strchrdeli #2", strchrdeli(work1, 's'), ans43);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelinew							*/
/*									*/

strcpy(work1, string3);
strchrdelinew(work2, work1, 's');
printline("strchrdelinew #1", work2, ans43);

strcpy(work1, string3);
printline("strchrdelinew #2", strchrdelinew(work2, work1, 's'), ans43);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelnew							*/
/*									*/
strchrdelnew(work1, string1, ' ');
printline("strchrdelnew #1", work1, ans23);

printline("strchrdelnew #2", strchrdelnew(work1, string1, ' '), ans23);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelrange							*/
/*									*/
strcpy(work1, string1);
strchrdelrange(work1,' ', 'e');
printline("strchrdelrange #1", work1, ans28);

strcpy(work1, string1);
printline("strchrdelrange #2", strchrdelrange(work1,' ', 'e'), ans28);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelrangenew						*/
/*									*/
strchrdelrangenew(work1, string1, ' ', 'e');
printline("strchrdelrangenew #1", work1, ans28);

printline("strchrdelrangenew #2",
		strchrdelrangenew(work1, string1, ' ', 'e'), ans28);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelgr							*/
/*									*/
strcpy(work1, string1);
strchrdelgr(work1, "e ");
printline("strchrdelgr #1", work1, ans24);

strcpy(work1, string1);
printline("strchrdelgr #2", strchrdelgr(work1, "e "), ans24);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrdelgrnew							*/
/*									*/
strchrdelgrnew(work1, string1, "e ");
printline("strchrdelgrnew #1", work1, ans24);

printline("strchrdelgrnew #2",
			strchrdelgrnew(work1, string1, "e "), ans24);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrfromc							*/
/*									*/
strcpy(work1, "\\\\");
tempc = strchrfromc(&tempi, work1);
itoa(tempi, work2, 10);
tempp = strend(work2);
tempp[0] = tempc;
tempp[1] = EOS;
printline("strchrfromc #1", work2, "2\\");

strcpy(work1, "\\t");
tempc = strchrfromc(&tempi, work1);
itoa(tempi, work2, 10);
tempp = strend(work2);
tempp[0] = tempc;
tempp[1] = EOS;
printline("strchrfromc #2", work2, "2\t");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrrpl							*/
/*									*/
strcpy(work1, string2);
strchrrpl(work1, ' ', '-');
printline("strchrrpl #1", work1, ans29);

strcpy(work1, string2);
printline("strchrrpl #2", strchrrpl(work1, ' ', '-'), ans29);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrrpli							*/
/*									*/
strcpy(work1, string3);
strchrrpli(work1, 'S', '-');
printline("strchrrpli #1", work1, ans44);

strcpy(work1, string3);
printline("strchrrpli #2", strchrrpli(work1, 'S', '-'), ans44);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrrplinew							*/
/*									*/
strcpy(work1, string3);
strchrrplinew(work2, work1, 'S', '-');
printline("strchrrplinew #1", work2, ans44);

strcpy(work1, string3);
printline("strchrrplinew #2",
		strchrrplinew(work2, work1, 'S', '-'), ans44);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrrplnew							*/
/*									*/
strchrrplnew(work1, string2, ' ', '-');
printline("strchrrplnew #1", work1, ans29);

printline("strchrrplnew #2", strchrrplnew(work1, string2, ' ', '-'), ans29);

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strchrtoc							*/
/*									*/
strcpy(work1, "\5\t\142");
strtoc(work1, "\5");
strtoc(work2, "\t");
strtoc(work3, "\142");
work4[0] = EOS;
strxcat(work4, work1, work2, work3, NULL);
printline("strchrtoc", work4, "\\x05\\tb");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcode1							*/
/*									*/
/*	char *strcode1 (char *instring,	char *codestring);		*/
/*									*/
strcpy(work1,"EXAMPLE CODING STRING");
strcpy(work2, "sample string to en/decode");
strcode1(work2, work1);
printline("strcode1 #1", work2, "69,=<)eS7=-')gT<t7'a# ;.)5");
strcode1(work2, work1);
printline("strcode1 #2", work2, "sample string to en/decode");

/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	strcode2							*/
/*									*/
/*	char *strcode2(char *instring);					*/
/*									*/
strcpy(work2, "sample string to en/decode");
strcode2(work2);
work1[0] = work2[1];			/* just check a couple		*/
work1[1] = work2[3];			/*   of converted characters	*/
work1[2] = EOS;
printline("strcode2 #1", work1, "7P");
strcode2(work2);		/* this re-convert is the real test	*/
printline("strcode2 #2", work2, "sample string to en/decode");


⌨️ 快捷键说明

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