- str.charAt( index )
"micromajor".charAt(0) // =>"m" - str.indexOf( searchValue[, fromIndex] )
"micro-major".indexOf("-") // => 5
"micro-major".indexOf("major") // => 6
"micromajor".indexOf("-") // => -1 - str.search( regexp )
"micromajor163".search(/[0-9]/) // => 10 - str.match( regexp )
"micromajor163".match(/[0-9]/) // => ["1"]
"micromajor163".match(/[0-9]/g) // => ["1","6","3"] - str.replace( regexp | substr, newSubstr | function )
"micromajor163".replace("163", "###") // => "micromajor###"
"micromajor163".replace(/[0-9]/, "#") // => "micromajor#63"
"micromajor163".replace(/[0-9]/g, "#") // => "micromajor###" - str.substring( indexA[, indexB] )
"micromajor".substring(5, 7) // => "ma"
"micromajor".substring(5) // => "major" - str.slice( beginSlice[, endSlice] )
"micromajor".slice(5, 7) // => "ma"
"micromajor".slice(5) // => "major"
"micromajor".slice(1, -1) // => "icromajor"
"micromajor".slice(-3) // => "jor" - str.subStr( start[, length] )
"micromajor".substr(5, 2) // => "ma"
"micromajor".substr(5) // => "major" - str.split( [separator][, limit] )
"micro major".splite(" ") // => ["micro","major"]
"micro major".splite(" ", 1) // => ["micro"]
"micro2major".splite(/[0-9]/) // => ["micro","major"] - str.toLowerCase()
"MicroMajor".toLowerCase() // => "micromajor" - str.toUpperCase()
"micromajor".toUpperCase() // => "MICROMAJOR" - String()
String(163) // => "163" - 连接
"micro" + "major" // => "micromajor" - 转义
"micro"major" // => "micro"major"
网友评论