(1)indexof 方法
返回 string 物件內第一次出現子字串的字元位置。
strobj.indexof(substring[, startindex])
引數 strobj
必選項。string 物件或文字。
substring
必選項。要在 string 物件中查詢的子字串。
starindex
可選項。該整數值指出在 string 物件內開始查詢的索引。如果省略,則從字串的開始處查詢。
說明 indexof 方法返回乙個整數值,指出 string 物件內子字串的開始位置。如果沒有找到子字串,則返回 -1。
如果 startindex 是負數,則 startindex 被當作零。如果它比最大的字元位置索引還大,則它被當作最大的可能索引。
從左向右執行查詢。否則,該方法與 lastindexof 相同。
示例 下面的示例說明了 indexof 方法的用法。
function indexdemo(str2)
(2)tolowercase()
返回乙個字串,該字串中的字母被轉換為小寫字母。
strvariable.tolowercase( )
"string literal".tolowercase( )
說明
tolowercase 方法對非字母字元不會產生影響。
下面的示例演示了 of the tolowercase 方法的效果:
var strvariable = "this is a string object";
strvariable = strvariable.tolowercase( );
this is a string object
libuv 不斷更新
initialize the uv async t handle.a null callback is allowed.note that uv async init unlike other libuv functions,immediately starts the handle.to stop...
JS常用類庫, 不斷更新
獲取字串長度 區分中英文,中文兩個位元組 string.prototype.getbytes function 擷取字串長度 區分中英文,中文兩個位元組.超出部分中指定字串代替 需引用 string.prototype.getbytes string.prototype.cutbytes funct...
C 學習積累 不斷更新
分享乙個c 的學習 1.結構體 struct 所有的成員在預設條件下都是 public 類 class 所有資料成員在預設條件下都是private 2.建構函式 採用的是類名,前邊不需要加返回值。3.在定義的類後邊一定要加 例如 void 4.類的繼承。include class animal vo...