導航:首頁 > 凈水問答 > 23過濾多餘的空格

23過濾多餘的空格

發布時間:2024-07-30 02:54:06

過濾多餘空格 C++

#include<stdio.h>
#include<string.h>
intmain()
{
chara[1000]={0};
charb[1000]={0};
inti,j,l;
gets(a);
l=strlen(a);
for(i=0,j=0;i<l;i++,j++)
{
b[j]=a[i];
if(a[i]=='')
{
for(i+=1;i<l;i++)
{
if(a[i]=='')
{
continue;
}
else
i-=1;
break;
}
}
}
b[j]='';
puts(b);
return0;
}

Ⅱ 易語言過濾多餘重復的空格

文本替換,把【兩個空格】換成【一個空格】,直到沒有【兩個空格】存在。代碼很簡短。在此不碼,可以追問。

Ⅲ 超簡單C語言,看一下錯哪了 過濾掉多餘的空格,只留下一個空格

if(!((zfc[i]=' ')&&(zfc[i+1]=' ')))你這句錯了,邏輯判斷,你寫成賦語句了。數組使用時最好清零一次。

Ⅳ 用php過濾html部分標簽

$str=preg_replace("/\s+/", " ", $str); //過濾多餘回車
$str=preg_replace("/<[ ]+/si","<",$str); //過濾<__("<"號後面帶空格)

$str=preg_replace("/<\!--.*?-->/si","",$str); //注釋
$str=preg_replace("/<(\!.*?)>/si","",$str); //過濾DOCTYPE
$str=preg_replace("/<(\/?html.*?)>/si","",$str); //過濾html標簽
$str=preg_replace("/<(\/?head.*?)>/si","",$str); //過濾head標簽
$str=preg_replace("/<(\/?meta.*?)>/si","",$str); //過濾meta標簽
$str=preg_replace("/<(\/?body.*?)>/si","",$str); //過濾body標簽
$str=preg_replace("/<(\/?link.*?)>/si","",$str); //過濾link標簽
$str=preg_replace("/<(\/?form.*?)>/si","",$str); //過濾form標簽
$str=preg_replace("/cookie/si","COOKIE",$str); //過濾COOKIE標簽

$str=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$str); //過濾applet標簽
$str=preg_replace("/<(\/?applet.*?)>/si","",$str); //過濾applet標簽

$str=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$str); //過濾style標簽
$str=preg_replace("/<(\/?style.*?)>/si","",$str); //過濾style標簽

$str=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$str); //過濾title標簽
$str=preg_replace("/<(\/?title.*?)>/si","",$str); //過濾title標簽

$str=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$str); //過濾object標簽
$str=preg_replace("/<(\/?objec.*?)>/si","",$str); //過濾object標簽

$str=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$str); //過濾noframes標簽
$str=preg_replace("/<(\/?noframes.*?)>/si","",$str); //過濾noframes標簽

$str=preg_replace("/<(i?frame.*?)>(.*?)<(\/i?frame.*?)>/si","",$str); //過濾frame標簽
$str=preg_replace("/<(\/?i?frame.*?)>/si","",$str); //過濾frame標簽

$str=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$str); //過濾script標簽
$str=preg_replace("/<(\/?script.*?)>/si","",$str); //過濾script標簽
$str=preg_replace("/javascript/si","Javascript",$str); //過濾script標簽
$str=preg_replace("/vbscript/si","Vbscript",$str); //過濾script標簽
$str=preg_replace("/on([a-z]+)\s*=/si","On\\1=",$str); //過濾script標簽
$str=preg_replace("/&#/si","&#",$str); //過濾script標簽,如javAsCript:alert(

清除空格,換行

function DeleteHtml($str)
{
$str = trim($str);
$str = strip_tags($str,"");
$str = ereg_replace("\t","",$str);
$str = ereg_replace("\r\n","",$str);
$str = ereg_replace("\r","",$str);
$str = ereg_replace("\n","",$str);
$str = ereg_replace(" "," ",$str);
return trim($str);
}

過濾HTML屬性

1,過濾所有html標簽的正則表達式:

復制代碼 代碼如下:

</?[^>]+>

//過濾所有html標簽的屬性的正則表達式:

$html = preg_replace("/<([a-zA-Z]+)[^>]*>/","<\\1>",$html);

3,過濾部分html標簽的正則表達式的排除式(比如排除<p>,即不過濾<p>):

復制代碼 代碼如下:

</?[^pP/>]+>

4,過濾部分html標簽的正則表達式的枚舉式(比如需要過濾<a><p><b>等):

復制代碼 代碼如下:

</?[aApPbB][^>]*>

5,過濾部分html標簽的屬性的正則表達式的排除式(比如排除alt屬性,即不過濾alt屬性):

復制代碼 代碼如下:

\s(?!alt)[a-zA-Z]+=[^\s]*

6,過濾部分html標簽的屬性的正則表達式的枚舉式(比如alt屬性):

復制代碼 代碼如下:

(\s)alt=[^\s]*

Ⅳ c++過濾多餘的空格

雖然啰嗦了點,但沒有看出大問題來!把cout<<str;改成cout << str << endl;試試。

閱讀全文

與23過濾多餘的空格相關的資料

熱點內容
純水機制水量多少合適 瀏覽:88
鹽城超純水一般多少錢 瀏覽:974
dw100凈水器怎麼換濾芯 瀏覽:783
scn廢水 瀏覽:231
台安縣污水處理廠屬於什麼單位 瀏覽:136
家附近污水處理場 瀏覽:51
美國純凈水器哪裡買 瀏覽:4
F0F水垢處理 瀏覽:375
污水廠細格柵池 瀏覽:117
污水處理cod數值 瀏覽:951
江蘇宜興污水處理公司 瀏覽:777
污水標准值 瀏覽:263
石材廢水處理視頻 瀏覽:270
凈化器怎麼放水視頻 瀏覽:308
水處理反硝化菌有哪些 瀏覽:378
營口市化學化工區污水處理廠 瀏覽:206
純水開水器發熱圈怎麼接線 瀏覽:814
焦化廠廢水處理該怎麼工作 瀏覽:498
原油蒸餾的三種曲線 瀏覽:162
機油濾芯需要擰到什麼程度 瀏覽:359