Code of filtering the HTML control character

xiaoxiao2021-03-06  73

This is the code of the HTML character that I finished in "<>" in the "<>" that I wrote, I don't know if there is a simple method:

Void ConvertHTMLString (Char * InputBuffer) // InputBuffer length <1024

{

char tmpBuffer [1024]; char * pTmpBuffer = tmpBuffer; bool flags = true; while (* inputBuffer ) {if (* inputBuffer == '<') {flags = true; continue;} if (* inputBuffer == '>' ) {Flags = false; Continue;}

IF (! Flags) * (PTMPBuffer ) = * InputBuffer;} * ptmpbuffer = '/ 0'; Printf ("Result String:% S / N", TmpBuffer;}

test:

Char msg [] = " News link ";

ConvertHTMLSTRING (MSG);

RESULTS: News Link

转载请注明原文地址:https://www.9cbs.com/read-121121.html

New Post(0)