ASP中雙引號單引號和 連線符使用技巧

2021-08-23 15:35:48 字數 1058 閱讀 2884

asp中雙引號單引號和&連線符使用技巧

一、asp中處在雙引號中的可以是任意的字元、字串,html**

1.<%response.write ("i am here")%><%response.write ("cnbruce here")%>

2.<%response.write ("i am here")%>

3.《雙引號為就近匹配,如有單引號and連線符包含於和連線將《延後引號》response.write("i am here")

因為color的前引號和write的前引號形成匹配,內容為i am here。最終結果是:中間的 #0000ff 被孤單了

<%response.write("i am here")%>

<%

response.write("cnbruce")

%>

二、單引號:如學習語文課一樣,繼續放在雙引號中的引號可以採用單引號

response.write("i am here")

三、asp中&號的主要作用是用來連線的,包括:字串-字串、字串-變數、變數-變數等混合連線

<%

mycolor="#0000ff"

response.write ("" & "cnbruce" & "")

%>

<%

mycolor="#0000ff"

response.write ("" & "cnbruce" & "")

%>

單引號(雙引號中不用)中《變數保持》關鍵寫法:《將asp中的變數繼續新增左右的"&包括》,就可以放到response.write的引號中了,效果即為:response.write(" "&mycolor&" ")

注:asp《輸出response主要處理變數,字串,html**》(對單一標記可做為字串來處理)

response.write"a"

response.write("a")

顯示一樣都是輸出的《字串a,>

而response.write(a)和<%=a%><%=a%>輸出的是變數a 的值

單引號和雙引號

char p1 1 char p2 1 1 的ascii碼值為49 0和49位址處為作業系統使用,故訪問這些位址如printf s,s,s p1,p2,p3 會產生段錯誤。printf n n的ascii碼值為10,同理,段錯誤。a 表示字元常量,在記憶體中佔1個位元組,a 1表示 a 的ascii...

單引號( )和雙引號( )

關鍵是要養成良好的習慣.單引號 一般用在單字元,如 c 雙引號 一般用在字串,如 abc 如果巢狀使用的話,一般用交替方法,尤其是html中.如,也可以改成.在分割乙個字串時要用到str.split或者regex.split。簡單的單個字串的替換,直接用字串.split 單個字串 多個字串的替換用r...

Python中單引號和雙引號

python中可以用單引號 或者雙引號 表示字串,如 print hello world print hello world 輸出結果是一樣的,如下 如果字串中含有帶引號的字串呢?用另外一種引號即可。如 print i d much rather you not print i said do no...