| 方法 |
描述 |
傳參樣本 |
結果 |
| Asc(string) |
返回第一個字元的ASCII碼,相當於JS的String.charCodeAt |
"Alpha" |
65 |
| Chr(charcode) |
返回對應的字母,相當於JS的String.fromCharCode |
65 |
A |
| CStr(expression) |
把運算式轉換為字串類型 |
5+5 |
10 |
| InStr([start,]string,substring) |
可返回substring在string中首次出現的位置。相當於JS的indexOf |
"Two words","w" 3,"Two words","w" |
2 5 |
| InStrRev(string,substring[,start]) |
返回substring在string中首次出現的位置。搜尋從字串的末端開始,但是返回的位置是從字串的起點開始計數的,相當於JS的lastIndexOf。 |
"1234567890123","3" "1234567890123","3",5 |
13 3 |
| Join(stringarray[,delimter]) |
將一個字串數群組轉換為數組,delimter為分隔字元,預設是空白字元,相當於JS中的數組方法join. |
Array("one","two","three") Array("one","two","three"),"*" |
one two three one*two*three |
| LCase(string) |
把指定的字串轉換為小寫。相當於JS的toLowerCase |
"LOWERCASE" |
lowercase |
| Left(string,number) |
從字串的左側返回指定數目的字元,有點像JS的substr方法 |
"Left Nine Characters.",9 |
Left Nine |
| Len(string) |
返回字串的長度 |
"This string is 34 characters long." |
34 |
| LTrim(string) |
除去字串開始的空格,就是firefox的trimLeft方法 |
" No leading spaces." |
No leading spaces. |
| Mid(string,start[,length]) |
從字串中返回指定數目的字元,用法與JS的slice差不多 |
"This is the middle of the string.",13 "This is the middle of the string.",13,6 |
middle of the string. middle |
| Replace(string,a,b) |
將字串string中的a子串全部替換為b子串,與JS的replace方法差不多 |
"These characters are the Right Ten.",10 |
Right Ten. |
| RTrim(string) |
去掉右邊的空白,就是firefox的trimRight方法 |
"No trailing spaces. " |
No trailing spaces. |
| Space(number) |
返回由指定數目的空格組成的字串 |
10 |
|
| Split(string[,delimter]) |
用分隔字元切割實際字串為數組,預設是一個格的空白字元. |
"How now brown cow?" "How now, brown cow?","," |
Array("How","now","brown","cow?") Array("How now"," brown cow?") |
| StrComp(string1,string2) |
比較兩個字串,並返回表示比較結果的一個值,返回1,0,-1,1表示大於 |
"beta","alpha" "alpha","alpha" "alpha","beta" |
1 0 -1 |
| StrReverse(string) |
反轉一個字串 |
".redro esrever ni gnirts tupni eht si sihT" |
This is the input string in reverse order. |
| String(number,charcode) |
返回包含指定長度的重複字元的一個字串 |
10,65 |
AAAAAAAAAA |
| Trim(string) |
去掉兩端的空白,就是JS的trim方法 |
" No leading or trailing spaces. " |
No leading or trailing spaces. |
| UCase(string) |
將所有字母大寫化,相當於JS的toUpperCase. |
"uppercase" |
UPPERCASE |