String Object Properties
Property | Description |
---|---|
constructor | 返回的函數創建的String對象的原型 |
length | 回傳字串數 |
prototype | 添加方法的屬性 |
String Object Methods
Method | Description |
---|---|
charAt() | 回傳指定位置字元 |
charCodeAt() | 指定位置字元的十六進位值,並以十進位值回傳 |
concat() | 將兩個字串組成因字串 |
fromCharCode(n1, n2,nX) | Unicode碼轉成字串 |
indexOf(str,start) | 由第一個字元,開始搜尋特定字串 |
lastIndexOf(str,start) | 由最後個字元,開始搜尋特定字串 |
match(regexp) | 回傳符合regexp,回傳為陣列 |
replace(str1,str2) | 將str1字串更換str2字串 |
search(regexp) | 回傳符合的搜尋位置,如都不符合則回傳-1 |
slice(begin,end) | 擷取字串的特定字元,維新字串,begin(開始),end(結束) |
split(char,howmany) | 將字串轉陣列,char(為分隔字元),howmany(指定要回傳多少陣列值) |
substr(start,length) | 擷取字串的特定字元,維新字串,start(開始),length(字元數,可以不填) |
substring(start,end) | 擷取字串的特定字元,維新字串,start(開始),end(結束位置) |
toLowerCase() | 將字串轉為小寫 |
toUpperCase() | 將字串轉為大寫 |
valueOf() | Returns the primitive value of a String object |
String HTML Wrapper Methods
The HTML wrapper methods return the string wrapped inside the appropriate HTML tag.
Method | Description |
---|---|
anchor() | 將字串加上錨點 |
big() | 以較大的字級顯示字串 |
blink() | 以閃爍方式顯示字串 |
bold() | 以粗體顯示字串 |
fixed() | 以單調字(固定大小)顯示文字,相當於使用<pre>標籤 |
fontcolor() | 為字串加上顏色 |
fontsize() | 調整字串字字體大小 |
italics() | 以斜體顯示字串 |
link() | 為字串加上超連結 |
small() | 以較小字體顯示 |
strike() | 為字串加上刪除線 |
sub() | 以下標字顯示字串 |
sup() | 以上標字顯示字串 |
沒有留言:
張貼留言